def do_run(self, line):
        """
        Command that send the order to the framework to launch this util

        Args:
        -----
            line: the string of the line typed.
        """
        print
        # Checking if all the required parameters have been set
        if self._checkIfRequiredAreSet():
            print(general.info("Collecting the options set by the user..."))
            # Getting the parser...
            parser = phonefy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print(
                general.info("Launching " + self.UNAME +
                             " with the following parameters: ") +
                general.emphashis(str(params)))

            try:
                usufy.main(args)
            except Exception as e:
                print(
                    gemeral.error(
                        "[!] ERROR. Something happenned when launching the utility. Type 'show options' to check the parameters. "
                    ))
                print(general.error("Traceback: " + str(e)))
        else:
            print(
                general.error(
                    "[!] ERROR. There are required parameters which have not been set."
                ))
            self.do_show("options")
        print(general.success("Execution ended successfully."))
Beispiel #2
0
    def do_run(self, line):
        """Running the current application. This method should be redefined for each util."""
        print
        # Checking if all the required parameters have been set
        if self._checkIfRequiredAreSet():
            print(general.info("Collecting the options set by the user..."))
            # Getting the parser...
            parser = usufy.getParser()

            # Generating the parameters
            params = self._getParams()

            args = parser.parse_args(params)

            print(general.info("Launching " + self.UNAME + " with the following parameters: ") + general.emphashis(str(params)))

            try:
                usufy.main(args)
            except Exception as e:
                print(gemeral.error("[!] ERROR. Something happenned when launching the utility. Type 'show options' to check the parameters. "))
                print(general.error("Traceback: " + str(e)))
        else:
            print(general.error("[!] ERROR. There are required parameters which have not been set."))
            self.do_show("options")
        print(general.success("Execution ended successfully."))