def add_parser(subparsers, parent_parser): FREEZE_HELP = "Freeze stages or .dvc files." freeze_parser = subparsers.add_parser( "freeze", parents=[parent_parser], description=append_doc_link(FREEZE_HELP, "freeze"), help=FREEZE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) freeze_parser.add_argument( "targets", nargs="+", help="Stages or .dvc files to freeze").complete = completion.DVC_FILE freeze_parser.set_defaults(func=CmdFreeze) UNFREEZE_HELP = "Unfreeze stages or .dvc files." unfreeze_parser = subparsers.add_parser( "unfreeze", parents=[parent_parser], description=append_doc_link(UNFREEZE_HELP, "unfreeze"), help=UNFREEZE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) unfreeze_parser.add_argument( "targets", nargs="+", help="Stages or .dvc files to unfreeze").complete = completion.DVC_FILE unfreeze_parser.set_defaults(func=CmdUnfreeze)
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(experiments_subparsers, parent_parser): from . import add_rev_selection_flags EXPERIMENTS_LIST_HELP = "List local and remote experiments." experiments_list_parser = experiments_subparsers.add_parser( "list", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_LIST_HELP, "exp/list"), help=EXPERIMENTS_LIST_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) add_rev_selection_flags(experiments_list_parser, "List") experiments_list_parser.add_argument( "--name-only", "--names-only", action="store_true", help="Only output experiment names (without parent commits).", ) experiments_list_parser.add_argument( "git_remote", nargs="?", default=None, help=("Optional Git remote name or Git URL. " "If provided, experiments from the specified Git repository " " will be listed instead of local ones."), metavar="<git_remote>", ) experiments_list_parser.set_defaults(func=CmdExperimentsList)
def add_parser(experiments_subparsers, parent_parser): EXPERIMENTS_RUN_HELP = "Run or resume an experiment." experiments_run_parser = experiments_subparsers.add_parser( "run", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_RUN_HELP, "exp/run"), help=EXPERIMENTS_RUN_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) _add_run_common(experiments_run_parser) experiments_run_parser.add_argument( "-r", "--rev", type=str, dest="checkpoint_resume", help=("Continue the specified checkpoint experiment. Can only be used " "in conjunction with --queue or --temp."), metavar="<experiment_rev>", ).complete = completion.EXPERIMENT experiments_run_parser.add_argument( "--reset", action="store_true", help="Reset existing checkpoints and restart the experiment.", ) experiments_run_parser.set_defaults(func=CmdExperimentsRun)
def add_parser(experiments_subparsers, parent_parser): from . import add_rev_selection_flags EXPERIMENTS_PUSH_HELP = "Push a local experiment to a Git remote." experiments_push_parser = experiments_subparsers.add_parser( "push", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_PUSH_HELP, "exp/push"), help=EXPERIMENTS_PUSH_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) add_rev_selection_flags(experiments_push_parser, "Push", False) experiments_push_parser.add_argument( "-f", "--force", action="store_true", help="Replace experiment in the Git remote if it already exists.", ) experiments_push_parser.add_argument( "--no-cache", action="store_false", dest="push_cache", help=("Do not push cached outputs for this experiment to DVC remote " "storage."), ) experiments_push_parser.add_argument( "-r", "--remote", dest="dvc_remote", metavar="<name>", help="Name of the DVC remote to use when pushing cached outputs.", ) experiments_push_parser.add_argument( "-j", "--jobs", type=int, metavar="<number>", help=( "Number of jobs to run simultaneously when pushing to DVC remote " "storage."), ) experiments_push_parser.add_argument( "--run-cache", action="store_true", default=False, help="Push run history for all stages.", ) experiments_push_parser.add_argument( "git_remote", help="Git remote name or Git URL.", metavar="<git_remote>", ) experiments_push_parser.add_argument( "experiment", nargs="*", default=None, help="Experiments to push.", metavar="<experiment>", ).complete = completion.EXPERIMENT experiments_push_parser.set_defaults(func=CmdExperimentsPush)
def add_parser(subparsers, parent_parser): REPRO_HELP = ( "Reproduce complete or partial pipelines by executing their stages.") repro_parser = subparsers.add_parser( "repro", parents=[parent_parser], description=append_doc_link(REPRO_HELP, "repro"), help=REPRO_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) # repro/exp run shared args add_arguments(repro_parser) # repro only args repro_parser.add_argument( "--glob", action="store_true", default=False, help="Allows targets containing shell-style wildcards.", ) repro_parser.add_argument( "--no-commit", action="store_true", default=False, help="Don't put files/directories into cache.", ) repro_parser.add_argument( "--no-run-cache", action="store_true", default=False, help=("Execute stage commands even if they have already been run with " "the same command/dependencies/outputs/etc before."), ) repro_parser.set_defaults(func=CmdRepro)
def add_parser(experiments_subparsers, parent_parser): EXPERIMENTS_REMOVE_HELP = "Remove experiments." experiments_remove_parser = experiments_subparsers.add_parser( "remove", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_REMOVE_HELP, "exp/remove"), help=EXPERIMENTS_REMOVE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remove_group = experiments_remove_parser.add_mutually_exclusive_group() remove_group.add_argument("--queue", action="store_true", help="Remove all queued experiments.") remove_group.add_argument( "-A", "--all", action="store_true", help="Remove all committed experiments.", ) remove_group.add_argument( "-g", "--git-remote", metavar="<git_remote>", help="Name or URL of the Git remote to remove the experiment from", ) experiments_remove_parser.add_argument( "experiment", nargs="*", help="Experiments to remove.", metavar="<experiment>", ) experiments_remove_parser.set_defaults(func=CmdExperimentsRemove)
def add_parser(subparsers, parent_parser): DIFF_DESCRIPTION = ( "Show added, modified, or deleted data between commits in the DVC" " repository, or between a commit and the workspace." ) diff_parser = subparsers.add_parser( "diff", parents=[parent_parser], description=append_doc_link(DIFF_DESCRIPTION, "diff"), help=DIFF_DESCRIPTION, formatter_class=argparse.RawDescriptionHelpFormatter, ) diff_parser.add_argument( "--targets", nargs="*", help=( "Specific DVC-tracked files to compare. " "Accepts one or more file paths." ), metavar="<paths>", ).complete = completion.FILE diff_parser.add_argument( "a_rev", help="Old Git commit to compare (defaults to HEAD)", nargs="?", default="HEAD", ) diff_parser.add_argument( "b_rev", help=("New Git commit to compare (defaults to the current workspace)"), nargs="?", ) diff_parser.add_argument( "--json", "--show-json", help="Format the output into a JSON", action="store_true", default=False, ) diff_parser.add_argument( "--show-hash", help="Display hash value for each entry", action="store_true", default=False, ) diff_parser.add_argument( "--md", "--show-md", help="Show tabulated output in the Markdown format (GFM).", action="store_true", dest="markdown", default=False, ) diff_parser.add_argument( "--hide-missing", help="Hide missing cache file status.", action="store_true", ) diff_parser.set_defaults(func=CmdDiff)
def add_parser(experiments_subparsers, parent_parser): EXPERIMENTS_GC_HELP = "Garbage collect unneeded experiments." EXPERIMENTS_GC_DESCRIPTION = ( "Removes all experiments which are not derived from the specified" "Git revisions." ) experiments_gc_parser = experiments_subparsers.add_parser( "gc", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_GC_DESCRIPTION, "exp/gc"), help=EXPERIMENTS_GC_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) experiments_gc_parser.add_argument( "-w", "--workspace", action="store_true", default=False, help="Keep experiments derived from the current workspace.", ) experiments_gc_parser.add_argument( "-a", "--all-branches", action="store_true", default=False, help="Keep experiments derived from the tips of all Git branches.", ) experiments_gc_parser.add_argument( "-T", "--all-tags", action="store_true", default=False, help="Keep experiments derived from all Git tags.", ) experiments_gc_parser.add_argument( "-A", "--all-commits", action="store_true", default=False, help="Keep experiments derived from all Git commits.", ) experiments_gc_parser.add_argument( "--queued", action="store_true", default=False, help=( "Keep queued experiments (experiments run queue will be cleared " "by default)." ), ) experiments_gc_parser.add_argument( "-f", "--force", action="store_true", default=False, help="Force garbage collection - automatically agree to all prompts.", ) experiments_gc_parser.set_defaults(func=CmdExperimentsGC)
def add_parser(subparsers, parent_parser): IMPORT_HELP = ("Download file or directory tracked by DVC or by Git " "into the workspace, and track it.") import_parser = subparsers.add_parser( "import", parents=[parent_parser], description=append_doc_link(IMPORT_HELP, "import"), help=IMPORT_HELP, formatter_class=argparse.RawTextHelpFormatter, ) import_parser.add_argument( "url", help="Location of DVC or Git repository to download from") import_parser.add_argument( "path", help="Path to a file or directory within the repository" ).complete = completion.FILE import_parser.add_argument( "-o", "--out", nargs="?", help="Destination path to download files to", metavar="<path>", ).complete = completion.DIR import_parser.add_argument( "--rev", nargs="?", help="Git revision (e.g. SHA, branch, tag)", metavar="<commit>", ) import_parser.add_argument( "--file", help="Specify name of the .dvc file this command will generate.", metavar="<filename>", ) import_parser.add_argument( "--no-exec", action="store_true", default=False, help="Only create .dvc file without actually downloading it.", ) import_parser.add_argument( "--desc", type=str, metavar="<text>", help=("User description of the data (optional). " "This doesn't affect any DVC operations."), ) import_parser.add_argument( "-j", "--jobs", type=int, help=("Number of jobs to run simultaneously. " "The default value is 4 * cpu_count(). " "For SSH remotes, the default is 4. "), metavar="<number>", ) import_parser.set_defaults(func=CmdImport)
def add_parser(subparsers, parent_parser): ROOT_HELP = "Return the relative path to the root of the DVC project." root_parser = subparsers.add_parser( "root", parents=[parent_parser], description=append_doc_link(ROOT_HELP, "root"), help=ROOT_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) root_parser.set_defaults(func=CmdRoot)
def add_parser(experiments_subparsers, parent_parser): EXPERIMENTS_PULL_HELP = "Pull an experiment from a Git remote." experiments_pull_parser = experiments_subparsers.add_parser( "pull", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_PULL_HELP, "exp/pull"), help=EXPERIMENTS_PULL_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) experiments_pull_parser.add_argument( "-f", "--force", action="store_true", help="Replace local experiment already exists.", ) experiments_pull_parser.add_argument( "--no-cache", action="store_false", dest="pull_cache", help=("Do not pull cached outputs for this experiment from DVC remote " "storage."), ) experiments_pull_parser.add_argument( "-r", "--remote", dest="dvc_remote", metavar="<name>", help="Name of the DVC remote to use when pulling cached outputs.", ) experiments_pull_parser.add_argument( "-j", "--jobs", type=int, metavar="<number>", help=("Number of jobs to run simultaneously when pulling from DVC " "remote storage."), ) experiments_pull_parser.add_argument( "--run-cache", action="store_true", default=False, help="Pull run history for all stages.", ) experiments_pull_parser.add_argument( "git_remote", help="Git remote name or Git URL.", metavar="<git_remote>", ) experiments_pull_parser.add_argument( "experiment", nargs="+", help="Experiments to pull.", metavar="<experiment>", ) experiments_pull_parser.set_defaults(func=CmdExperimentsPull)
def add_parser(subparsers, parent_parser): REPRO_HELP = ( "Reproduce complete or partial pipelines by executing their stages.") repro_parser = subparsers.add_parser( "repro", parents=[parent_parser], description=append_doc_link(REPRO_HELP, "repro"), help=REPRO_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) add_arguments(repro_parser) repro_parser.set_defaults(func=CmdRepro)
def add_parser(subparsers, parent_parser): VERSION_HELP = ( "Display the DVC version and system/environment information.") version_parser = subparsers.add_parser( "version", parents=[parent_parser], description=append_doc_link(VERSION_HELP, "version"), help=VERSION_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, aliases=["doctor"], ) version_parser.set_defaults(func=CmdVersion)
def add_parser(subparsers, parent_parser): DAG_HELP = "Visualize DVC project DAG." dag_parser = subparsers.add_parser( "dag", parents=[parent_parser], description=append_doc_link(DAG_HELP, "dag"), help=DAG_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) dag_parser.add_argument( "--dot", action="store_true", default=False, help="Print DAG with .dot format.", ) dag_parser.add_argument( "--mermaid", action="store_true", default=False, help="Print DAG with mermaid format.", ) dag_parser.add_argument( "--md", "--show-md", action="store_true", default=False, dest="markdown", help="Print DAG with mermaid format wrapped in Markdown block.", ) dag_parser.add_argument( "--full", action="store_true", default=False, help=( "Show full DAG that the target belongs too, instead of " "showing DAG consisting only of ancestors." ), ) dag_parser.add_argument( "-o", "--outs", action="store_true", default=False, help="Print output files instead of stages.", ) dag_parser.add_argument( "target", nargs="?", help="Stage or output to show pipeline for (optional). " "Finds all stages in the workspace by default.", ) dag_parser.set_defaults(func=CmdDAG)
def add_parser(subparsers, parent_parser): CHECKOUT_HELP = "Checkout data files from cache." checkout_parser = subparsers.add_parser( "checkout", parents=[parent_parser], description=append_doc_link(CHECKOUT_HELP, "checkout"), help=CHECKOUT_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) checkout_parser.add_argument( "--summary", action="store_true", default=False, help="Show summary of the changes.", ) checkout_parser.add_argument( "-d", "--with-deps", action="store_true", default=False, help="Checkout all dependencies of the specified target.", ) checkout_parser.add_argument( "-R", "--recursive", action="store_true", default=False, help="Checkout all subdirectories of the specified directory.", ) checkout_parser.add_argument( "-f", "--force", action="store_true", default=False, help="Do not prompt when removing working directory files.", ) checkout_parser.add_argument( "--relink", action="store_true", default=False, help="Recreate links or copies from cache to workspace.", ) checkout_parser.add_argument( "targets", nargs="*", help=("Limit command scope to these tracked files/directories, " ".dvc files, or stage names."), ).complete = completion.DVC_FILE checkout_parser.set_defaults(func=CmdCheckout)
def add_parser(subparsers, parent_parser): UPDATE_HELP = "Update data artifacts imported from other DVC repositories." update_parser = subparsers.add_parser( "update", parents=[parent_parser], description=append_doc_link(UPDATE_HELP, "update"), help=UPDATE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) update_parser.add_argument( "targets", nargs="+", help=".dvc files to update." ).complete = completion.DVC_FILE update_parser.add_argument( "--rev", nargs="?", help="Git revision (e.g. SHA, branch, tag)", metavar="<commit>", ) update_parser.add_argument( "-R", "--recursive", action="store_true", default=False, help="Update all stages in the specified directory.", ) update_parser.add_argument( "--to-remote", action="store_true", default=False, help="Update data directly on the remote", ) update_parser.add_argument( "-r", "--remote", help="Remote storage to perform updates to", metavar="<name>", ) update_parser.add_argument( "-j", "--jobs", type=int, help=( "Number of jobs to run simultaneously. " "The default value is 4 * cpu_count(). " "For SSH remotes, the default is 4. " ), metavar="<number>", ) update_parser.set_defaults(func=CmdUpdate)
def add_parser(experiments_subparsers, parent_parser): EXPERIMENTS_BRANCH_HELP = "Promote an experiment to a Git branch." experiments_branch_parser = experiments_subparsers.add_parser( "branch", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_BRANCH_HELP, "exp/branch"), help=EXPERIMENTS_BRANCH_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) experiments_branch_parser.add_argument("experiment", help="Experiment to be promoted.") experiments_branch_parser.add_argument("branch", help="Git branch name to use.") experiments_branch_parser.set_defaults(func=CmdExperimentsBranch)
def add_parser(subparsers, parent_parser): UNPROTECT_HELP = ( "Unprotect tracked files or directories (when hardlinks or symlinks " "have been enabled with `dvc config cache.type`).") unprotect_parser = subparsers.add_parser( "unprotect", parents=[parent_parser], description=append_doc_link(UNPROTECT_HELP, "unprotect"), help=UNPROTECT_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) unprotect_parser.add_argument( "targets", nargs="+", help="Data files/directories to unprotect.").complete = completion.FILE unprotect_parser.set_defaults(func=CmdUnprotect)
def add_parser(subparsers, parent_parser): from dvc.commands.stage import _add_common_args RUN_HELP = ( "Generate a dvc.yaml file from a command and execute the command." ) run_parser = subparsers.add_parser( "run", parents=[parent_parser], description=append_doc_link(RUN_HELP, "run"), help=RUN_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) run_parser.add_argument("-n", "--name", help="Stage name.") run_parser.add_argument( "--file", metavar="<filename>", help=argparse.SUPPRESS ) run_parser.add_argument( "--no-exec", action="store_true", default=False, help="Only create dvc.yaml without actually running it.", ) run_parser.add_argument( "--no-run-cache", action="store_true", default=False, help=( "Execute the command even if this stage has already been run " "with the same command/dependencies/outputs/etc before." ), ) run_parser.add_argument( "--no-commit", action="store_true", default=False, help="Don't put files/directories into cache.", ) run_parser.add_argument( "--single-stage", action="store_true", default=False, help=argparse.SUPPRESS, ) _add_common_args(run_parser) run_parser.set_defaults(func=CmdRun)
def add_parser(subparsers, parent_parser): INSTALL_HELP = "Install DVC git hooks into the repository." install_parser = subparsers.add_parser( "install", parents=[parent_parser], description=append_doc_link(INSTALL_HELP, "install"), help=INSTALL_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) install_parser.add_argument( "--use-pre-commit-tool", action="store_true", default=False, help="Install DVC hooks using pre-commit " "(https://pre-commit.com) if it is installed.", ) install_parser.set_defaults(func=CmdInstall)
def add_parser(subparsers, parent_parser): DESTROY_HELP = "Remove DVC files, local DVC config and data cache." destroy_parser = subparsers.add_parser( "destroy", parents=[parent_parser], description=append_doc_link(DESTROY_HELP, "destroy"), help=DESTROY_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) destroy_parser.add_argument( "-f", "--force", action="store_true", default=False, help="Force destruction.", ) destroy_parser.set_defaults(func=CmdDestroy)
def add_parser(subparsers, parent_parser): COMPLETION_HELP = "Generate shell tab completion." COMPLETION_DESCRIPTION = "Prints out shell tab completion scripts." completion_parser = subparsers.add_parser( "completion", parents=[parent_parser], description=append_doc_link(COMPLETION_DESCRIPTION, "completion"), help=COMPLETION_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) completion_parser.add_argument( "-s", "--shell", help="Shell syntax for completions.", default="bash", choices=["bash", "zsh"], ) completion_parser.set_defaults(func=CmdCompletion)
def add_parser(subparsers, parent_parser): ADD_HELP = ( "Check whether files or directories are excluded due to `.dvcignore`.") parser = subparsers.add_parser( "check-ignore", parents=[parent_parser], description=append_doc_link(ADD_HELP, "check-ignore"), help=ADD_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) parser.add_argument( "-d", "--details", action="store_true", default=False, help="Show the exclude patterns along with each target path.", ) parser.add_argument( "-a", "--all", action="store_true", default=False, help="Include the target paths which don’t match any pattern " "in the `--details` list.", ) parser.add_argument( "-n", "--non-matching", action="store_true", default=False, help="Include the target paths which don’t match any pattern " "in the `--details` list.", ) parser.add_argument( "--stdin", action="store_true", default=False, help="Read paths from standard input instead of providing `targets`.", ) parser.add_argument( "targets", nargs="*", help="File or directory paths to check").complete = completion.FILE parser.set_defaults(func=CmdCheckIgnore)
def add_parser(subparsers, parent_parser): MOVE_HELP = "Rename or move a DVC controlled data file or a directory." MOVE_DESCRIPTION = ( "Rename or move a DVC controlled data file or a directory.\n" "It renames and modifies the corresponding .dvc file to reflect the" " changes.") move_parser = subparsers.add_parser( "move", parents=[parent_parser], description=append_doc_link(MOVE_DESCRIPTION, "move"), help=MOVE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) move_parser.add_argument("src", help="Source path to a data file or directory." ).complete = completion.FILE move_parser.add_argument( "dst", help="Destination path.").complete = completion.FILE move_parser.set_defaults(func=CmdMove)
def add_parser(experiments_subparsers, parent_parser): EXPERIMENTS_APPLY_HELP = ( "Apply the changes from an experiment to your workspace.") experiments_apply_parser = experiments_subparsers.add_parser( "apply", parents=[parent_parser], description=append_doc_link(EXPERIMENTS_APPLY_HELP, "exp/apply"), help=EXPERIMENTS_APPLY_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) experiments_apply_parser.add_argument( "--no-force", action="store_false", dest="force", help="Fail if this command would overwrite conflicting changes.", ) experiments_apply_parser.add_argument( "experiment", help="Experiment to be applied.").complete = completion.EXPERIMENT experiments_apply_parser.set_defaults(func=CmdExperimentsApply)
def add_parser(subparsers, parent_parser): LIST_HELP = ("List repository contents, including files" " and directories tracked by DVC and by Git.") list_parser = subparsers.add_parser( "list", aliases=["ls"], parents=[parent_parser], description=append_doc_link(LIST_HELP, "list"), help=LIST_HELP, formatter_class=argparse.RawTextHelpFormatter, ) list_parser.add_argument("url", help="Location of DVC repository to list") list_parser.add_argument( "-R", "--recursive", action="store_true", help="Recursively list files.", ) list_parser.add_argument("--dvc-only", action="store_true", help="Show only DVC outputs.") list_parser.add_argument( "--json", "--show-json", action="store_true", help="Show output in JSON format.", ) list_parser.add_argument( "--rev", nargs="?", help="Git revision (e.g. SHA, branch, tag)", metavar="<commit>", ) list_parser.add_argument( "path", nargs="?", help="Path to directory within the repository to list outputs for", ).complete = completion.DIR list_parser.set_defaults(func=CmdList)
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): COMMIT_HELP = ("Record changes to files or directories tracked by DVC" " by storing the current versions in the cache.") commit_parser = subparsers.add_parser( "commit", parents=[parent_parser], description=append_doc_link(COMMIT_HELP, "commit"), help=COMMIT_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) commit_parser.add_argument( "-f", "--force", action="store_true", default=False, help="Commit even if hash value for dependencies/outputs changed.", ) commit_parser.add_argument( "-d", "--with-deps", action="store_true", default=False, help="Commit all dependencies of the specified target.", ) commit_parser.add_argument( "-R", "--recursive", action="store_true", default=False, help="Commit cache for subdirectories of the specified directory.", ) commit_parser.add_argument( "targets", nargs="*", help="stages or .dvc files to commit. Optional. " "(Finds all DVC files in the workspace by default.)", ).complete = completion.DVCFILES_AND_STAGE commit_parser.set_defaults(func=CmdCommit)
def add_parser(subparsers, parent_parser): REMOVE_HELP = ("Remove stages from dvc.yaml and/or" " stop tracking files or directories.") remove_parser = subparsers.add_parser( "remove", parents=[parent_parser], description=append_doc_link(REMOVE_HELP, "remove"), help=REMOVE_HELP, formatter_class=argparse.RawDescriptionHelpFormatter, ) remove_parser.add_argument( "--outs", action="store_true", default=False, help="Remove outputs as well.", ) remove_parser.add_argument( "targets", nargs="+", help=".dvc files or stages from dvc.yaml to remove.", ).complete = completion.DVC_FILE remove_parser.set_defaults(func=CmdRemove)