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)
评论列表
文章目录