def add_parser(subparsers, parent_parser): from dvc.commands.config import parent_config_parser CACHE_HELP = "Manage cache settings." cache_parser = subparsers.add_parser( "cache", parents=[parent_parser], description=append_doc_link(CACHE_HELP, "cache"), help=CACHE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) cache_subparsers = cache_parser.add_subparsers( dest="cmd", help="Use `dvc cache CMD --help` for command-specific " "help.", ) fix_subparsers(cache_subparsers) parent_cache_config_parser = argparse.ArgumentParser( add_help=False, parents=[parent_config_parser]) CACHE_DIR_HELP = "Configure cache directory location." cache_dir_parser = cache_subparsers.add_parser( "dir", parents=[parent_parser, parent_cache_config_parser], description=append_doc_link(CACHE_HELP, "cache/dir"), help=CACHE_DIR_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) cache_dir_parser.add_argument( "-u", "--unset", default=False, action="store_true", help="Unset option.", ) cache_dir_parser.add_argument( "value", help="Path to cache directory. Relative paths are resolved relative " "to the current directory and saved to config relative to the " "config file location. If no path is provided, it returns the " "current cache directory.", nargs="?", ).complete = completion.DIR cache_dir_parser.set_defaults(func=CmdCacheDir)
def add_parser(subparsers, parent_parser): LIVE_DESCRIPTION = ( "Commands to visualize and compare dvclive-produced logs." ) live_parser = subparsers.add_parser( "live", parents=[parent_parser], formatter_class=argparse.RawDescriptionHelpFormatter, description=LIVE_DESCRIPTION, ) live_subparsers = live_parser.add_subparsers( dest="cmd", help="Use `dvc live CMD --help` to display command-specific help.", ) fix_subparsers(live_subparsers) SHOW_HELP = "Visualize dvclive directory content." live_show_parser = live_subparsers.add_parser( "show", parents=[parent_parser, shared_parent_parser()], help=SHOW_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) live_show_parser.set_defaults(func=CmdLiveShow) DIFF_HELP = ( "Show multiple versions of dvclive data, " "by plotting it in single view." ) live_diff_parser = live_subparsers.add_parser( "diff", parents=[parent_parser, shared_parent_parser()], help=DIFF_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) live_diff_parser.add_argument( "--revs", nargs="*", default=None, help="Git revision (e.g. SHA, branch, tag)", metavar="<commit>", ) live_diff_parser.set_defaults(func=CmdLiveDiff)
def add_parser(subparsers, parent_parser): EXPERIMENTS_HELP = "Commands to run and compare experiments." experiments_parser = subparsers.add_parser( "experiments", parents=[parent_parser], aliases=["exp"], description=append_doc_link(EXPERIMENTS_HELP, "exp"), formatter_class=argparse.RawDescriptionHelpFormatter, help=EXPERIMENTS_HELP, ) experiments_subparsers = experiments_parser.add_subparsers( dest="cmd", help="Use `dvc experiments CMD --help` to display " "command-specific help.", ) fix_subparsers(experiments_subparsers) for cmd in SUB_COMMANDS: cmd.add_parser(experiments_subparsers, parent_parser) fix_plumbing_subparsers(experiments_subparsers)
def add_parser(subparsers, parent_parser): DAEMON_HELP = "Service daemon." daemon_parser = subparsers.add_parser( "daemon", parents=[parent_parser], description=DAEMON_HELP, add_help=False, ) daemon_subparsers = daemon_parser.add_subparsers( dest="cmd", help="Use `dvc daemon CMD --help` for command-specific " "help.", ) fix_subparsers(daemon_subparsers) DAEMON_UPDATER_HELP = "Fetch latest available version." daemon_updater_parser = daemon_subparsers.add_parser( "updater", parents=[parent_parser], description=DAEMON_UPDATER_HELP, help=DAEMON_UPDATER_HELP, ) daemon_updater_parser.set_defaults(func=CmdDaemonUpdater) DAEMON_ANALYTICS_HELP = "Send dvc usage analytics." daemon_analytics_parser = daemon_subparsers.add_parser( "analytics", parents=[parent_parser], description=DAEMON_ANALYTICS_HELP, help=DAEMON_ANALYTICS_HELP, ) daemon_analytics_parser.add_argument( "target", help="Analytics file.").complete = completion.FILE daemon_analytics_parser.set_defaults(func=CmdDaemonAnalytics)
def add_parser(subparsers, parent_parser): from dvc.commands.config import parent_config_parser REMOTE_HELP = "Set up and manage data remotes." remote_parser = subparsers.add_parser( "remote", parents=[parent_parser], description=append_doc_link(REMOTE_HELP, "remote"), help=REMOTE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_subparsers = remote_parser.add_subparsers( dest="cmd", help="Use `dvc remote CMD --help` for " "command-specific help.", ) fix_subparsers(remote_subparsers) REMOTE_ADD_HELP = "Add a new data remote." remote_add_parser = remote_subparsers.add_parser( "add", parents=[parent_config_parser, parent_parser], description=append_doc_link(REMOTE_ADD_HELP, "remote/add"), help=REMOTE_ADD_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_add_parser.add_argument("name", help="Name of the remote") remote_add_parser.add_argument( "url", help="Remote location. See full list of supported URLs at {}".format( format_link("https://man.dvc.org/remote")), ) remote_add_parser.add_argument( "-d", "--default", action="store_true", default=False, help="Set as default remote.", ) remote_add_parser.add_argument( "-f", "--force", action="store_true", default=False, help="Force overwriting existing configs", ) remote_add_parser.set_defaults(func=CmdRemoteAdd) REMOTE_DEFAULT_HELP = "Set/unset the default data remote." remote_default_parser = remote_subparsers.add_parser( "default", parents=[parent_config_parser, parent_parser], description=append_doc_link(REMOTE_DEFAULT_HELP, "remote/default"), help=REMOTE_DEFAULT_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_default_parser.add_argument("name", nargs="?", help="Name of the remote") remote_default_parser.add_argument( "-u", "--unset", action="store_true", default=False, help="Unset default remote.", ) remote_default_parser.set_defaults(func=CmdRemoteDefault) REMOTE_MODIFY_HELP = "Modify the configuration of a data remote." remote_modify_parser = remote_subparsers.add_parser( "modify", parents=[parent_config_parser, parent_parser], description=append_doc_link(REMOTE_MODIFY_HELP, "remote/modify"), help=REMOTE_MODIFY_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_modify_parser.add_argument("name", help="Name of the remote") remote_modify_parser.add_argument("option", help="Name of the option to modify.") remote_modify_parser.add_argument("value", nargs="?", help="(optional) Value of the option.") remote_modify_parser.add_argument( "-u", "--unset", default=False, action="store_true", help="Unset option.", ) remote_modify_parser.set_defaults(func=CmdRemoteModify) REMOTE_LIST_HELP = "List all available data remotes." remote_list_parser = remote_subparsers.add_parser( "list", parents=[parent_config_parser, parent_parser], description=append_doc_link(REMOTE_LIST_HELP, "remote/list"), help=REMOTE_LIST_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_list_parser.set_defaults(func=CmdRemoteList) REMOTE_REMOVE_HELP = "Remove a data remote." remote_remove_parser = remote_subparsers.add_parser( "remove", parents=[parent_config_parser, parent_parser], description=append_doc_link(REMOTE_REMOVE_HELP, "remote/remove"), help=REMOTE_REMOVE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_remove_parser.add_argument("name", help="Name of the remote to remove.") remote_remove_parser.set_defaults(func=CmdRemoteRemove) REMOTE_RENAME_HELP = "Rename a DVC remote" remote_rename_parser = remote_subparsers.add_parser( "rename", parents=[parent_config_parser, parent_parser], description=append_doc_link(REMOTE_RENAME_HELP, "remote/rename"), help=REMOTE_RENAME_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remote_rename_parser.add_argument("name", help="Remote to be renamed") remote_rename_parser.add_argument("new", help="New name of the remote") remote_rename_parser.set_defaults(func=CmdRemoteRename)
def add_parser(subparsers, parent_parser): PLOTS_HELP = ( "Commands to visualize and compare plot metrics in structured files " "(JSON, YAML, CSV, TSV)." ) plots_parser = subparsers.add_parser( "plots", parents=[parent_parser], description=append_doc_link(PLOTS_HELP, "plots"), help=PLOTS_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) plots_subparsers = plots_parser.add_subparsers( dest="cmd", help="Use `dvc plots CMD --help` to display command-specific help.", ) fix_subparsers(plots_subparsers) SHOW_HELP = "Generate plots from metrics files." plots_show_parser = plots_subparsers.add_parser( "show", parents=[parent_parser], description=append_doc_link(SHOW_HELP, "plots/show"), help=SHOW_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) plots_show_parser.add_argument( "targets", nargs="*", help="Files to visualize (supports any file, " "even when not found as `plots` in `dvc.yaml`). " "Shows all plots by default.", ).complete = completion.FILE _add_props_arguments(plots_show_parser) _add_output_argument(plots_show_parser) _add_ui_arguments(plots_show_parser) plots_show_parser.set_defaults(func=CmdPlotsShow) PLOTS_DIFF_HELP = ( "Show multiple versions of plot metrics " "by plotting them in a single image." ) plots_diff_parser = plots_subparsers.add_parser( "diff", parents=[parent_parser], description=append_doc_link(PLOTS_DIFF_HELP, "plots/diff"), help=PLOTS_DIFF_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) plots_diff_parser.add_argument( "--targets", nargs="*", help=( "Specific plots file(s) to visualize " "(even if not found as `plots` in `dvc.yaml`). " "Shows all tracked plots by default." ), metavar="<paths>", ).complete = completion.FILE plots_diff_parser.add_argument( "-e", "--experiment", action="store_true", default=False, help=argparse.SUPPRESS, ) plots_diff_parser.add_argument( "revisions", nargs="*", default=None, help="Git commits to plot from" ) _add_props_arguments(plots_diff_parser) _add_output_argument(plots_diff_parser) _add_ui_arguments(plots_diff_parser) plots_diff_parser.set_defaults(func=CmdPlotsDiff) PLOTS_MODIFY_HELP = ( "Modify display properties of data-series plots " "(has no effect on image-type plots)." ) plots_modify_parser = plots_subparsers.add_parser( "modify", parents=[parent_parser], description=append_doc_link(PLOTS_MODIFY_HELP, "plots/modify"), help=PLOTS_MODIFY_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) plots_modify_parser.add_argument( "target", help="Metric file to set properties to" ).complete = completion.FILE _add_props_arguments(plots_modify_parser) plots_modify_parser.add_argument( "--unset", nargs="*", metavar="<property>", help="Unset one or more display properties.", ) plots_modify_parser.set_defaults(func=CmdPlotsModify) TEMPLATES_HELP = ( "Write built-in plots templates to a directory " "(.dvc/plots by default)." ) plots_templates_parser = plots_subparsers.add_parser( "templates", parents=[parent_parser], description=append_doc_link(TEMPLATES_HELP, "plots/templates"), help=TEMPLATES_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) plots_templates_parser.add_argument( "target", default=None, nargs="?", choices=CmdPlotsTemplates.TEMPLATES_CHOICES, help="Template to write. Writes all templates by default.", ) _add_output_argument(plots_templates_parser, typ="templates") plots_templates_parser.set_defaults(func=CmdPlotsTemplates)
def add_parser(subparsers, parent_parser): METRICS_HELP = "Commands to display and compare metrics." metrics_parser = subparsers.add_parser( "metrics", parents=[parent_parser], description=append_doc_link(METRICS_HELP, "metrics"), help=METRICS_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) metrics_subparsers = metrics_parser.add_subparsers( dest="cmd", help="Use `dvc metrics CMD --help` to display command-specific help.", ) fix_subparsers(metrics_subparsers) METRICS_SHOW_HELP = "Print metrics, with optional formatting." metrics_show_parser = metrics_subparsers.add_parser( "show", parents=[parent_parser], description=append_doc_link(METRICS_SHOW_HELP, "metrics/show"), help=METRICS_SHOW_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) metrics_show_parser.add_argument( "targets", nargs="*", help=("Limit command scope to these metrics files. Using -R, " "directories to search metrics files in can also be given."), ).complete = completion.FILE metrics_show_parser.add_argument( "-a", "--all-branches", action="store_true", default=False, help="Show metrics for all branches.", ) metrics_show_parser.add_argument( "-T", "--all-tags", action="store_true", default=False, help="Show metrics for all tags.", ) metrics_show_parser.add_argument( "-A", "--all-commits", action="store_true", default=False, help="Show metrics for all commits.", ) metrics_show_parser.add_argument( "--json", "--show-json", action="store_true", default=False, help="Show output in JSON format.", ) metrics_show_parser.add_argument( "--md", "--show-md", action="store_true", default=False, dest="markdown", help="Show tabulated output in the Markdown format (GFM).", ) metrics_show_parser.add_argument( "-R", "--recursive", action="store_true", default=False, help=("If any target is a directory, recursively search and process " "metrics files."), ) metrics_show_parser.add_argument( "--precision", type=int, help=("Round metrics to `n` digits precision after the decimal point. " f"Rounds to {DEFAULT_PRECISION} digits by default."), metavar="<n>", ) metrics_show_parser.set_defaults(func=CmdMetricsShow) METRICS_DIFF_HELP = ( "Show changes in metrics between commits in the DVC repository, or " "between a commit and the workspace.") metrics_diff_parser = metrics_subparsers.add_parser( "diff", parents=[parent_parser], description=append_doc_link(METRICS_DIFF_HELP, "metrics/diff"), help=METRICS_DIFF_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) metrics_diff_parser.add_argument( "a_rev", nargs="?", help="Old Git commit to compare (defaults to HEAD)") metrics_diff_parser.add_argument( "b_rev", nargs="?", help="New Git commit to compare (defaults to the current workspace)", ) metrics_diff_parser.add_argument( "--targets", nargs="*", help=("Specific metrics file(s) to compare " "(even if not found as `metrics` in `dvc.yaml`). " "Using -R, directories to search metrics files in " "can also be given." "Shows all tracked metrics by default."), metavar="<paths>", ).complete = completion.FILE metrics_diff_parser.add_argument( "-R", "--recursive", action="store_true", default=False, help=("If any target is a directory, recursively search and process " "metrics files."), ) metrics_diff_parser.add_argument( "--all", action="store_true", default=False, help="Show unchanged metrics as well.", ) metrics_diff_parser.add_argument( "--json", "--show-json", action="store_true", default=False, help="Show output in JSON format.", ) metrics_diff_parser.add_argument( "--md", "--show-md", action="store_true", default=False, dest="markdown", help="Show tabulated output in the Markdown format (GFM).", ) metrics_diff_parser.add_argument( "--no-path", action="store_true", default=False, help="Don't show metric path.", ) metrics_diff_parser.add_argument( "--precision", type=int, help=("Round metrics to `n` digits precision after the decimal point. " f"Rounds to {DEFAULT_PRECISION} digits by default."), metavar="<n>", ) metrics_diff_parser.set_defaults(func=CmdMetricsDiff)
def add_parser(subparsers, parent_parser): PARAMS_HELP = "Commands to display params." params_parser = subparsers.add_parser( "params", parents=[parent_parser], description=append_doc_link(PARAMS_HELP, "params"), help=PARAMS_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) params_subparsers = params_parser.add_subparsers( dest="cmd", help="Use `dvc params CMD --help` to display command-specific help.", ) fix_subparsers(params_subparsers) PARAMS_DIFF_HELP = ( "Show changes in params between commits in the DVC repository, or " "between a commit and the workspace.") params_diff_parser = params_subparsers.add_parser( "diff", parents=[parent_parser], description=append_doc_link(PARAMS_DIFF_HELP, "params/diff"), help=PARAMS_DIFF_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) params_diff_parser.add_argument( "a_rev", nargs="?", help="Old Git commit to compare (defaults to HEAD)") params_diff_parser.add_argument( "b_rev", nargs="?", help=("New Git commit to compare (defaults to the current workspace)"), ) params_diff_parser.add_argument( "--targets", nargs="*", help=("Specific params file(s) to compare " "(even if not found as `params` in `dvc.yaml`). " "Shows all tracked params by default."), metavar="<paths>", ).complete = completion.FILE params_diff_parser.add_argument( "--all", action="store_true", default=False, help="Show unchanged params as well.", ) params_diff_parser.add_argument( "--deps", action="store_true", default=False, help="Show only params that are stage dependencies.", ) params_diff_parser.add_argument( "--json", "--show-json", action="store_true", default=False, help="Show output in JSON format.", ) params_diff_parser.add_argument( "--md", "--show-md", action="store_true", default=False, dest="markdown", help="Show tabulated output in the Markdown format (GFM).", ) params_diff_parser.add_argument( "--no-path", action="store_true", default=False, help="Don't show params path.", ) params_diff_parser.set_defaults(func=CmdParamsDiff)
def add_parser(subparsers, parent_parser): GIT_HOOK_HELP = "Run GIT hook." git_hook_parser = subparsers.add_parser( "git-hook", parents=[parent_parser], description=GIT_HOOK_HELP, add_help=False, ) git_hook_subparsers = git_hook_parser.add_subparsers( dest="cmd", help="Use `dvc daemon CMD --help` for command-specific help.", ) fix_subparsers(git_hook_subparsers) PRE_COMMIT_HELP = "Run pre-commit GIT hook." pre_commit_parser = git_hook_subparsers.add_parser( "pre-commit", parents=[parent_parser], description=PRE_COMMIT_HELP, help=PRE_COMMIT_HELP, ) pre_commit_parser.add_argument( "args", nargs="*", help="Arguments passed by GIT or pre-commit tool.") pre_commit_parser.set_defaults(func=CmdPreCommit) POST_CHECKOUT_HELP = "Run post-checkout GIT hook." post_checkout_parser = git_hook_subparsers.add_parser( "post-checkout", parents=[parent_parser], description=POST_CHECKOUT_HELP, help=POST_CHECKOUT_HELP, ) post_checkout_parser.add_argument( "args", nargs="*", help="Arguments passed by GIT or pre-commit tool.") post_checkout_parser.set_defaults(func=CmdPostCheckout) PRE_PUSH_HELP = "Run pre-push GIT hook." pre_push_parser = git_hook_subparsers.add_parser( "pre-push", parents=[parent_parser], description=PRE_PUSH_HELP, help=PRE_PUSH_HELP, ) pre_push_parser.add_argument( "args", nargs="*", help="Arguments passed by GIT or pre-commit tool.") pre_push_parser.set_defaults(func=CmdPrePush) MERGE_DRIVER_HELP = "Run GIT merge driver." merge_driver_parser = git_hook_subparsers.add_parser( "merge-driver", parents=[parent_parser], description=MERGE_DRIVER_HELP, help=MERGE_DRIVER_HELP, ) merge_driver_parser.add_argument( "--ancestor", required=True, help="Ancestor's version of the conflicting file.", ) merge_driver_parser.add_argument( "--our", required=True, help="Current version of the conflicting file.") merge_driver_parser.add_argument( "--their", required=True, help="Other branch's version of the conflicting file.", ) merge_driver_parser.set_defaults(func=CmdMergeDriver)
def add_parser(subparsers, parent_parser): STAGES_HELP = "Commands to list and create stages." stage_parser = subparsers.add_parser( "stage", parents=[parent_parser], description=append_doc_link(STAGES_HELP, "stage"), help=STAGES_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) stage_subparsers = stage_parser.add_subparsers( dest="cmd", help="Use `dvc stage CMD --help` to display command-specific help.", ) fix_subparsers(stage_subparsers) STAGE_ADD_HELP = "Create stage" stage_add_parser = stage_subparsers.add_parser( "add", parents=[parent_parser], description=append_doc_link(STAGE_ADD_HELP, "stage/add"), help=STAGE_ADD_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) stage_add_parser.add_argument("-n", "--name", help="Name of the stage to add", required=True) _add_common_args(stage_add_parser) stage_add_parser.set_defaults(func=CmdStageAdd) STAGE_LIST_HELP = "List stages." stage_list_parser = stage_subparsers.add_parser( "list", parents=[parent_parser], description=append_doc_link(STAGE_LIST_HELP, "stage/list"), help=STAGE_LIST_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) stage_list_parser.add_argument( "targets", nargs="*", default=["dvc.yaml"], help=("Show stages from a dvc.yaml/.dvc file or a directory. " "'dvc.yaml' by default"), ) stage_list_parser.add_argument( "--all", action="store_true", default=False, help="List all of the stages in the repo.", ) stage_list_parser.add_argument( "--fail", action="store_true", default=False, help="Fail immediately, do not suppress any syntax errors.", ) stage_list_parser.add_argument( "-R", "--recursive", action="store_true", default=False, help="List all stages inside the specified directory.", ) stage_list_parser.add_argument( "--name-only", "--names-only", action="store_true", default=False, help="List only stage names.", ) stage_list_parser.set_defaults(func=CmdStageList)
def add_parser(subparsers, parent_parser): from dvc.commands.config import parent_config_parser machine_HELP = "Set up and manage cloud machines." machine_parser = subparsers.add_parser( "machine", parents=[parent_parser], description=append_doc_link(machine_HELP, "machine"), # NOTE: suppress help during development to hide command # help=machine_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_subparsers = machine_parser.add_subparsers( dest="cmd", help="Use `dvc machine CMD --help` for " "command-specific help.", ) fix_subparsers(machine_subparsers) machine_ADD_HELP = "Add a new data machine." machine_add_parser = machine_subparsers.add_parser( "add", parents=[parent_config_parser, parent_parser], description=append_doc_link(machine_ADD_HELP, "machine/add"), help=machine_ADD_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_add_parser.add_argument("name", help="Name of the machine") machine_add_parser.add_argument( "cloud", help="Machine cloud. See full list of supported clouds at {}".format( format_link("https://github.com/iterative/" "terraform-provider-iterative#machine")), ) machine_add_parser.add_argument( "-d", "--default", action="store_true", default=False, help="Set as default machine.", ) machine_add_parser.add_argument( "-f", "--force", action="store_true", default=False, help="Force overwriting existing configs", ) machine_add_parser.set_defaults(func=CmdMachineAdd) machine_DEFAULT_HELP = "Set/unset the default machine." machine_default_parser = machine_subparsers.add_parser( "default", parents=[parent_config_parser, parent_parser], description=append_doc_link(machine_DEFAULT_HELP, "machine/default"), help=machine_DEFAULT_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_default_parser.add_argument("name", nargs="?", help="Name of the machine") machine_default_parser.add_argument( "-u", "--unset", action="store_true", default=False, help="Unset default machine.", ) machine_default_parser.set_defaults(func=CmdMachineDefault) machine_LIST_HELP = "List the configuration of one/all machines." machine_list_parser = machine_subparsers.add_parser( "list", parents=[parent_config_parser, parent_parser], description=append_doc_link(machine_LIST_HELP, "machine/list"), help=machine_LIST_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_list_parser.add_argument( "--show-origin", default=False, action="store_true", help="Show the source file containing each config value.", ) machine_list_parser.add_argument( "name", nargs="?", type=str, help="name of machine to specify", ) machine_list_parser.set_defaults(func=CmdMachineList) machine_MODIFY_HELP = "Modify the configuration of an machine." machine_modify_parser = machine_subparsers.add_parser( "modify", parents=[parent_config_parser, parent_parser], description=append_doc_link(machine_MODIFY_HELP, "machine/modify"), help=machine_MODIFY_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_modify_parser.add_argument("name", help="Name of the machine") machine_modify_parser.add_argument("option", help="Name of the option to modify.") machine_modify_parser.add_argument("value", nargs="?", help="(optional) Value of the option.") machine_modify_parser.add_argument( "-u", "--unset", default=False, action="store_true", help="Unset option.", ) machine_modify_parser.set_defaults(func=CmdMachineModify) machine_RENAME_HELP = "Rename a machine " machine_rename_parser = machine_subparsers.add_parser( "rename", parents=[parent_config_parser, parent_parser], description=append_doc_link(machine_RENAME_HELP, "remote/rename"), help=machine_RENAME_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_rename_parser.add_argument("name", help="Machine to be renamed") machine_rename_parser.add_argument("new", help="New name of the machine") machine_rename_parser.set_defaults(func=CmdMachineRename) machine_REMOVE_HELP = "Remove an machine." machine_remove_parser = machine_subparsers.add_parser( "remove", parents=[parent_config_parser, parent_parser], description=append_doc_link(machine_REMOVE_HELP, "machine/remove"), help=machine_REMOVE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_remove_parser.add_argument("name", help="Name of the machine to remove.") machine_remove_parser.set_defaults(func=CmdMachineRemove) machine_CREATE_HELP = "Create and start a machine instance." machine_create_parser = machine_subparsers.add_parser( "create", parents=[parent_parser], description=append_doc_link(machine_CREATE_HELP, "machine/create"), help=machine_CREATE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_create_parser.add_argument("name", help="Name of the machine to create.") machine_create_parser.set_defaults(func=CmdMachineCreate) machine_STATUS_HELP = ( "List the status of running instances for one/all machines.") machine_status_parser = machine_subparsers.add_parser( "status", parents=[parent_parser], description=append_doc_link(machine_STATUS_HELP, "machine/status"), help=machine_STATUS_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_status_parser.add_argument("name", nargs="?", help="(optional) Name of the machine.") machine_status_parser.set_defaults(func=CmdMachineStatus) machine_DESTROY_HELP = "Destroy an machine instance." machine_destroy_parser = machine_subparsers.add_parser( "destroy", parents=[parent_parser], description=append_doc_link(machine_DESTROY_HELP, "machine/destroy"), help=machine_DESTROY_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_destroy_parser.add_argument( "name", help="Name of the machine instance to destroy.") machine_destroy_parser.set_defaults(func=CmdMachineDestroy) machine_SSH_HELP = "Connect to a machine via SSH." machine_ssh_parser = machine_subparsers.add_parser( "ssh", parents=[parent_parser], description=append_doc_link(machine_SSH_HELP, "machine/ssh"), help=machine_SSH_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) machine_ssh_parser.add_argument( "name", help="Name of the machine instance to connect to.") machine_ssh_parser.set_defaults(func=CmdMachineSsh)