def run_cli_wrapper(argv, wrappedclass=Shell, cliclass=GenericCLI, theme=None):
    logfile = sourcefile = None
    paged = False
    try:
        optlist, longopts, args = getopt.getopt(argv[1:], "?hgs:")
    except getopt.GetoptError:
            print wrappedclass.__doc__
            return
    for opt, val in optlist:
        if opt in ("-?", "-h", "--help"):
            print run_cli_wrapper.__doc__
            return
        elif opt == "-s":
            sourcefile = val
        elif opt == "-g":
            paged = True
        elif opt == "-l":
            logfile = open(val, "w")
    if args:
        targs, kwargs = breakout_args(args)
    else:
        targs, kwargs = (), {}
    try:
        obj = apply(wrappedclass, targs, kwargs)
    except (ValueError, TypeError):
        print "Bad parameters."
        print wrappedclass.__doc__
        return
    io = ConsoleIO()
    ui = UserInterface(io, None, theme)
    cmd = get_generic_cmd(obj, ui, cliclass)
    cmd._export("PS1", "%%I%s%%N(%s%s%s)> " % (wrappedclass.__name__,
                ", ".join(map(repr, targs)),  IF(kwargs, ", ", ""),
                ", ".join(map(lambda t: "%s=%r" % t, kwargs.items()))) )
    cli = CommandParser(cmd, logfile)
    if sourcefile:
        cli.parse(sourcefile)
    else:
        cli.interact()
Instantiate a class object (the wrappedclass), and run a CLI wrapper on it.
dataset/ETHPy150Open kdart/pycopia/fepy/pycopia/fepy/CLI.py/run_cli_wrapper