Exemple #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)
Exemple #2
0
 def __init__(self, args=None, colorize=True, width=None, formatter=None,
              indent=6):
     OptParser.__init__(self, args=args, prog=PROG, options=OPT,
                        actions=ACTIONS,
                        deprecated_options=DEPRECATED_OPTIONS,
                        deprecated_actions=DEPRECATED_ACTIONS,
                        actions_translations=ACTIONS_TRANSLATIONS,
                        global_options=mp.GLOBAL_OPTS,
                        svc_select_options=mp.SVC_SELECT_OPTS,
                        colorize=colorize, width=width,
                        formatter=formatter, indent=indent, async_actions=svc.ACTION_ASYNC)
Exemple #3
0
def main(argv):
    from rcOptParser import OptParser
    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.excError as exc:
        print(exc, file=sys.stderr)
        return 1
    kwargs = vars(options)
    globals()[action](**kwargs)