示例#1
0
def main(argv, node=None):
    parser = OptParser(prog=PROG, options=OPT, actions=ACTIONS,
                       deprecated_actions=DEPRECATED_ACTIONS,
                       global_options=GLOBAL_OPTS)
    options, action = parser.parse_args(argv)
    kwargs = vars(options)
    do_action(action, node=node, **kwargs)
示例#2
0
def main(argv):
    parser = OptParser(prog=PROG, options=OPT, actions=ACTIONS,
                       deprecated_actions=DEPRECATED_ACTIONS,
                       global_options=GLOBAL_OPTS)
    try:
        options, action = parser.parse_args(argv[1:])
    except ex.Error as exc:
        print(exc, file=sys.stderr)
        return 1
    kwargs = vars(options)
    globals()[action](**kwargs)