예제 #1
0
def test_no_matching_cmd(args):
    commands = [
        cmds.Command(hierarchy=['cmd-c'],
                     arg_keys=['arg-0', 'arg-1', 'arg-2'],
                     function=pytest.fail),
    ]

    with pytest.raises(Exception):
        cmds.execute(commands, args)
예제 #2
0
def test_no_matching_cmd(args):
    commands = [
        cmds.Command(
            hierarchy=['cmd-c'],
            arg_keys=['arg-0', 'arg-1', 'arg-2'],
            function=pytest.fail),
    ]

    with pytest.raises(Exception):
        cmds.execute(commands, args)
예제 #3
0
파일: main.py 프로젝트: timcharper/dcos-cli
def _main(argv):
    args = docopt.docopt(default_doc("service"),
                         argv=argv,
                         version="dcos-service version {}".format(
                             dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #4
0
파일: cli.py 프로젝트: nlsun/dcos-tunnel
def main():
    signal.signal(signal.SIGINT, signal_handler)
    args = docopt.docopt(__doc__,
                         version='dcos-marathon version {}'.format(
                             constants.version))

    return cmds.execute(_cmds(), args)
예제 #5
0
파일: main.py 프로젝트: SStar1314/dcos-cli
def _main(argv):
    args = docopt.docopt(
        default_doc("service"),
        argv=argv,
        version="dcos-service version {}".format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #6
0
파일: main.py 프로젝트: sschneid/dcos-cli
def _main(argv):
    """The main function for the 'task' subcommand"""

    # We must special case the 'dcos task exec' subcommand in order to
    # allow us to pass arguments to docopt in a more user-friendly
    # manner. Specifically, we need to be able to to pass arguments
    # beginning with "-" to the command we are trying to launch with
    # 'exec' without docopt trying to match them to a named parameter
    # for the 'dcos' command itself.
    if len(argv) > 1 and argv[1] == "exec":
        args = docopt_wrapper(
            default_doc("task_exec"),
            default_doc("task"),
            argv=argv[2:],
            version="dcos-task version {}".format(dcoscli.version),
            options_first=True,
            base_subcommand="task",
            subcommand="exec")
    else:
        args = docopt.docopt(
            default_doc("task"),
            argv=argv,
            version="dcos-task version {}".format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #7
0
파일: main.py 프로젝트: timcharper/dcos-cli
def _main(argv):
    args = docopt.docopt(default_doc("experimental"),
                         argv=argv,
                         version='dcos-experimental version {}'.format(
                             dcoscli.version))
    http.silence_requests_warnings()
    return cmds.execute(_cmds(), args)
예제 #8
0
파일: main.py 프로젝트: dockerq/dcos-cli
def _main(argv):
    """The main function for the 'task' subcommand"""

    # We must special case the 'dcos task exec' subcommand in order to
    # allow us to pass arguments to docopt in a more user-friendly
    # manner. Specifically, we need to be able to to pass arguments
    # beginning with "-" to the command we are trying to launch with
    # 'exec' without docopt trying to match them to a named parameter
    # for the 'dcos' command itself.
    if len(argv) > 1 and argv[1] == "exec":
        args = docopt_wrapper(
            default_doc("task_exec"),
            default_doc("task"),
            argv=argv[2:],
            version="dcos-task version {}".format(dcoscli.version),
            options_first=True,
            base_subcommand="task",
            subcommand="exec")
    else:
        args = docopt.docopt(
            default_doc("task"),
            argv=argv,
            version="dcos-task version {}".format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #9
0
def _main(argv):
    args = docopt.docopt(
        default_doc("marathon"),
        argv=argv,
        version='dcos-marathon version {}'.format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #10
0
파일: main.py 프로젝트: sschneid/dcos-cli
def _main(argv):
    args = docopt.docopt(
        default_doc("experimental"),
        argv=argv,
        version='dcos-experimental version {}'.format(dcoscli.version))
    http.silence_requests_warnings()
    return cmds.execute(_cmds(), args)
예제 #11
0
파일: cli.py 프로젝트: nlsun/dcos-tunnel
def main():
    signal.signal(signal.SIGINT, signal_handler)
    args = docopt.docopt(
        __doc__,
        version='dcos-marathon version {}'.format(constants.version))

    return cmds.execute(_cmds(), args)
예제 #12
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(
        _doc(),
        version="dcos-service version {}".format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #13
0
파일: main.py 프로젝트: sttts/dcos-cli
def _main():
    util.configure_logger_from_environ()

    args = docopt.docopt(
        __doc__,
        version="dcos-task version {}".format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #14
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(
        __doc__,
        version='dcos-help version {}'.format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #15
0
파일: main.py 프로젝트: vsinha/dcos-cli
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(_doc(),
                         version='dcos-help version {}'.format(
                             dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #16
0
def test_single_cmd(args):
    commands = [
        cmds.Command(hierarchy=['cmd-a', 'cmd-b'],
                     arg_keys=['arg-0', 'arg-1', 'arg-2'],
                     function=function),
    ]

    assert cmds.execute(commands, args) == 1
예제 #17
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(
        __doc__,
        version="dcos-node version {}".format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #18
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(_doc(),
                         version='dcos-package version {}'.format(
                             dcoscli.version))
    http.silence_requests_warnings()

    return cmds.execute(_cmds(), args)
예제 #19
0
def test_single_cmd(args):
    commands = [
        cmds.Command(
            hierarchy=['cmd-a', 'cmd-b'],
            arg_keys=['arg-0', 'arg-1', 'arg-2'],
            function=function),
    ]

    assert cmds.execute(commands, args) == 1
예제 #20
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(
        _doc(),
        version='dcos-package version {}'.format(dcoscli.version))
    http.silence_requests_warnings()

    return cmds.execute(_cmds(), args)
예제 #21
0
def test_missing_arg(args):
    commands = [
        cmds.Command(hierarchy=['cmd-a'],
                     arg_keys=['arg-3'],
                     function=pytest.fail),
    ]

    with pytest.raises(KeyError):
        returncode, err = cmds.execute(commands, args)
예제 #22
0
def test_missing_arg(args):
    commands = [
        cmds.Command(
            hierarchy=['cmd-a'],
            arg_keys=['arg-3'],
            function=pytest.fail),
    ]

    with pytest.raises(KeyError):
        returncode, err = cmds.execute(commands, args)
예제 #23
0
def _main():
    util.configure_logger_from_environ()

    args = docopt.docopt(
        __doc__,
        version='myriad cli version {}'.format(constants.version))

    http.silence_requests_warnings()

    return cmds.execute(_cmds(), args)
예제 #24
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(__doc__,
                         version='dcos-management version {}'.format(
                             constants.version))

    http.silence_requests_warnings()

    return cmds.execute(_cmds(), args)
예제 #25
0
파일: cli.py 프로젝트: lloesche/dcos-tunnel
def main():
    signal.signal(signal.SIGINT, signal_handler)
    args = docopt.docopt(__doc__, version=constants.version)

    try:
        ret = cmds.execute(_cmds(), args)
    except DCOSException as e:
        emitter.publish(e)
        ret = 1
    return ret
예제 #26
0
def _main():
    util.configure_logger_from_environ()

    args = docopt.docopt(__doc__,
                         version='myriad cli version {}'.format(
                             constants.version))

    http.silence_requests_warnings()

    return cmds.execute(_cmds(), args)
예제 #27
0
def test_similar_cmds(args):
    commands = [
        cmds.Command(hierarchy=['cmd-a', 'cmd-b'],
                     arg_keys=['arg-0', 'arg-1', 'arg-2'],
                     function=function),
        cmds.Command(hierarchy=['cmd-a'],
                     arg_keys=['arg-0', 'arg-1', 'arg-2'],
                     function=pytest.fail),
    ]

    assert cmds.execute(commands, args) == 1
예제 #28
0
파일: cli.py 프로젝트: dcos/dcos-tunnel
def main():
    signal.signal(signal.SIGINT, signal_handler)
    args = docopt.docopt(
        __doc__,
        version=constants.version)

    try:
        ret = cmds.execute(_cmds(), args)
    except DCOSException as e:
        emitter.publish(e)
        ret = 1
    return ret
예제 #29
0
def test_similar_cmds(args):
    commands = [
        cmds.Command(
            hierarchy=['cmd-a', 'cmd-b'],
            arg_keys=['arg-0', 'arg-1', 'arg-2'],
            function=function),
        cmds.Command(
            hierarchy=['cmd-a'],
            arg_keys=['arg-0', 'arg-1', 'arg-2'],
            function=pytest.fail),
    ]

    assert cmds.execute(commands, args) == 1
예제 #30
0
파일: main.py 프로젝트: SStar1314/dcos-cli
def _main(argv):
    args = docopt.docopt(default_doc("node"),
                         argv=argv,
                         version="dcos-node version {}".format(
                             dcoscli.version))

    if args.get('--master'):
        raise DCOSException(
            '--master has been deprecated. Please use --leader.')
    elif args.get('--slave'):
        raise DCOSException(
            '--slave has been deprecated. Please use --mesos-id.')

    return cmds.execute(_cmds(), args)
예제 #31
0
파일: main.py 프로젝트: takirala/dcos-cli
def _main(argv):

    for i, arg in enumerate(argv):
        if arg == '--show-failures':
            argv[i] = '--failures'
            warning = ("'--show-failures' is deprecated, "
                       "please use '--failures' instead.\n")
            emitter.publish(DefaultError(warning))

    args = docopt.docopt(default_doc("job"),
                         argv=argv,
                         version='dcos-job version {}'.format(dcoscli.version))

    return cmds.execute(_cmds(), args)
예제 #32
0
파일: main.py 프로젝트: surdy/dcos-cli
def _main(argv):
    args = docopt.docopt(
        default_doc("node"),
        argv=argv,
        version="dcos-node version {}".format(dcoscli.version))

    if args.get('--master'):
        raise DCOSException(
            '--master has been deprecated. Please use --leader.'
        )
    elif args.get('--slave'):
        raise DCOSException(
            '--slave has been deprecated. Please use --mesos-id.'
        )

    return cmds.execute(_cmds(), args)
예제 #33
0
def _main():
    util.configure_process_from_environ()

    args = docopt.docopt(
        _doc(),
        version="dcos-node version {}".format(dcoscli.version))

    if args.get('--master'):
        raise DCOSException(
            '--master has been deprecated. Please use --leader.'
        )
    elif args.get('--slave'):
        raise DCOSException(
            '--slave has been deprecated. Please use --mesos-id.'
        )

    return cmds.execute(_cmds(), args)
예제 #34
0
파일: main.py 프로젝트: ksauzz/dcos-cli
def _main(argv):
    doc_name = 'cluster'

    # If a cluster is attached and the cluster linker API is reachable,
    # use cluster_ee.txt.
    dcos_url = config.get_config_val('core.dcos_url')
    if dcos_url:
        try:
            cluster.get_cluster_links(dcos_url)
            doc_name = 'cluster_ee'
        except Exception:
            pass

    args = docopt.docopt(
        default_doc(doc_name),
        argv=argv,
        version='dcos-cluster version {}'.format(dcoscli.version))

    http.silence_requests_warnings()

    return cmds.execute(_cmds(doc_name), args)