def makeRunCommand()

in fblldb.py [0:0]


def makeRunCommand(command, filename):
    def runCommand(debugger, input, exe_ctx, result, _):
        command.result = result
        command.context = exe_ctx
        splitInput = command.lex(input)

        # OptionParser will throw in the case where you want just one
        # big long argument and no options and you enter something
        # that starts with '-' in the argument. e.g.:
        #     somecommand -[SomeClass someSelector:]
        # This solves that problem by prepending a '--' so that
        # OptionParser does the right thing.
        options = command.options()
        if len(options) == 0:
            if "--" not in splitInput:
                splitInput.insert(0, "--")

        parser = optionParserForCommand(command)
        (options, args) = parser.parse_args(splitInput)

        # When there are more args than the command has declared, assume
        # the initial args form an expression and combine them into a single arg.
        if len(args) > len(command.args()):
            overhead = len(args) - len(command.args())
            head = args[: overhead + 1]  # Take N+1 and reduce to 1.
            args = [" ".join(head)] + args[-overhead:]

        if validateArgsForCommand(args, command):
            command.run(args, options)

    runCommand.__doc__ = helpForCommand(command, filename)
    return runCommand