def run(self, argv):
try:<EOL><INDENT>index = <NUM_LIT:0><EOL>command_pos = -<NUM_LIT:1><EOL>help_pos = -<NUM_LIT:1><EOL>help_command_pos = -<NUM_LIT:1><EOL>for arg in argv:<EOL><INDENT>if arg == '<STR_LIT>' and help_command_pos == -<NUM_LIT:1>:<EOL><INDENT>self._bash_completion()<EOL>return <NUM_LIT:0><EOL><DEDENT>if arg in self.commands[self.api_version]:<EOL><INDENT>if command_pos == -<NUM_LIT:1>:<EOL><INDENT>command_pos = index<EOL><DEDENT><DEDENT>elif arg in ('<STR_LIT>', '<STR_LIT>'):<EOL><INDENT>if help_pos == -<NUM_LIT:1>:<EOL><INDENT>help_pos = index<EOL><DEDENT><DEDENT>elif arg == '<STR_LIT>':<EOL><INDENT>if help_command_pos == -<NUM_LIT:1>:<EOL><INDENT>help_command_pos = index<EOL><DEDENT><DEDENT>index = index + <NUM_LIT:1><EOL><DEDENT>if command_pos > -<NUM_LIT:1> and help_pos > command_pos:<EOL><INDENT>argv = ['<STR_LIT>', argv[command_pos]]<EOL><DEDENT>if help_command_pos > -<NUM_LIT:1> and command_pos == -<NUM_LIT:1>:<EOL><INDENT>argv[help_command_pos] = '<STR_LIT>'<EOL><DEDENT>self.options, remainder = self.parser.parse_known_args(argv)<EOL>self.configure_logging()<EOL>self.interactive_mode = not remainder<EOL>self.initialize_app(remainder)<EOL><DEDENT>except Exception as err:<EOL><INDENT>if self.options.verbose_level >= self.DEBUG_LEVEL:<EOL><INDENT>self.log.exception(err)<EOL>raise<EOL><DEDENT>else:<EOL><INDENT>self.log.error(err)<EOL><DEDENT>return <NUM_LIT:1><EOL><DEDENT>if self.interactive_mode:<EOL><INDENT>_argv = [sys.argv[<NUM_LIT:0>]]<EOL>sys.argv = _argv<EOL>return self.interact()<EOL><DEDENT>return self.run_subcommand(remainder)<EOL>
Equivalent to the main program for the application.

        :param argv: input arguments and options
        :paramtype argv: list of str