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)
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)