コード例 #1
0
ファイル: main.py プロジェクト: lowks/lymph
def main(argv=None):
    import iris.monkey
    iris.monkey.patch()

    import docopt

    from iris import __version__ as VERSION
    from iris.cli.help import HELP
    from iris.cli.base import get_command_class

    args = docopt.docopt(HELP, argv, version=VERSION, options_first=True)
    name = args.pop('<command>')
    argv = args.pop('<args>')
    try:
        command_cls = get_command_class(name)
    except KeyError:
        print("'%s' is not a valid iris command. See 'iris list' or 'iris --help'." % name)
        return 1
    command_args = docopt.docopt(command_cls.get_help(), [name] + argv)
    args.update(command_args)

    config = setup_config(args) if command_cls.needs_config else None

    setup_logging(args, config)
    if config:
        config.set('container.log_endpoint', zmqpub_log_handler.endpoint)
    terminal = setup_terminal(args, config)
    command = command_cls(args, config, terminal)
    return command.run()
コード例 #2
0
def main(argv=None):
    import iris.monkey
    iris.monkey.patch()

    import docopt

    from iris import __version__ as VERSION
    from iris.cli.help import HELP
    from iris.cli.base import get_command_class

    args = docopt.docopt(HELP, argv, version=VERSION, options_first=True)
    name = args.pop('<command>')
    argv = args.pop('<args>')
    try:
        command_cls = get_command_class(name)
    except KeyError:
        print(
            "'%s' is not a valid iris command. See 'iris list' or 'iris --help'."
            % name)
        return 1
    command_args = docopt.docopt(command_cls.get_help(), [name] + argv)
    args.update(command_args)

    config = setup_config(args) if command_cls.needs_config else None

    setup_logging(args, config)
    if config:
        config.set('container.log_endpoint', zmqpub_log_handler.endpoint)
    terminal = setup_terminal(args, config)
    command = command_cls(args, config, terminal)
    return command.run()
コード例 #3
0
ファイル: help.py プロジェクト: johbo/iris
 def run(self):
     name = self.args['<command>']
     if name:
         print(get_command_class(name).get_help())
     else:
         print(HELP)
コード例 #4
0
 def run(self):
     name = self.args['<command>']
     if name:
         print(get_command_class(name).get_help())
     else:
         print(HELP)