def handle(self, prog, name, args=None):

        args = list(args or [])

        try:
            command = self._commands[name]
        except __HOLE__:
            raise InvalidCommand, "Command %s not found" % name

        help_args = ('-h', '--help')

        # remove -h from args if present, and add to remaining args
        app_args = [a for a in args if a not in help_args]

        app_parser = self.create_parser(prog)
        app_namespace, remaining_args = app_parser.parse_known_args(app_args)

        for arg in help_args:
            if arg in args:
                remaining_args.append(arg)

        command_parser = command.create_parser(prog + " " + name)
        if getattr(command, 'capture_all_args', False):
            command_namespace, unparsed_args = \
                command_parser.parse_known_args(remaining_args)
            positional_args = [unparsed_args]
        else:
            command_namespace = command_parser.parse_args(remaining_args)
            positional_args = []
        
        app = self.create_app(**app_namespace.__dict__)

        command.handle(app, *positional_args, **command_namespace.__dict__)
dataset/ETHPy150Open danjac/Flask-Script/flaskext/script.py/Manager.handle