cli: lowercase metavar by default (#10227)

* cli: lowercase metavar by default

* add tests for help message
This commit is contained in:
skshetry
2024-01-11 12:53:17 +05:45
committed by GitHub
parent 1c06302a47
commit eae4fe21ce
62 changed files with 180 additions and 210 deletions
+14
View File
@@ -0,0 +1,14 @@
import argparse
class HelpFormatter(argparse.HelpFormatter):
def _get_default_metavar_for_optional(self, action: argparse.Action) -> str:
return action.dest
class RawTextHelpFormatter(HelpFormatter, argparse.RawTextHelpFormatter):
pass
class RawDescriptionHelpFormatter(HelpFormatter, argparse.RawDescriptionHelpFormatter):
pass
+4 -4
View File
@@ -50,7 +50,7 @@ from dvc.commands import (
) )
from dvc.log import logger from dvc.log import logger
from . import DvcParserError from . import DvcParserError, formatter
logger = logger.getChild(__name__) logger = logger.getChild(__name__)
@@ -165,7 +165,7 @@ def get_main_parser():
prog="dvc", prog="dvc",
description=desc, description=desc,
parents=[parent_parser], parents=[parent_parser],
formatter_class=argparse.RawTextHelpFormatter, formatter_class=formatter.RawTextHelpFormatter,
add_help=False, add_help=False,
) )
@@ -200,9 +200,9 @@ def get_main_parser():
# Sub commands # Sub commands
subparsers = parser.add_subparsers( subparsers = parser.add_subparsers(
title="Available Commands", title="Available Commands",
metavar="COMMAND", metavar="command",
dest="cmd", dest="cmd",
help="Use `dvc COMMAND --help` for command-specific help.", help="Use `dvc command --help` for command-specific help.",
) )
from .utils import fix_subparsers from .utils import fix_subparsers
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -71,7 +69,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(ADD_HELP, "add"), description=append_doc_link(ADD_HELP, "add"),
help=ADD_HELP, help=ADD_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
parser.add_argument( parser.add_argument(
"--no-commit", "--no-commit",
+3 -5
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import DictAction, append_doc_link, fix_subparsers from dvc.cli.utils import DictAction, append_doc_link, fix_subparsers
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -47,7 +45,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(ARTIFACTS_HELP, "artifacts"), description=append_doc_link(ARTIFACTS_HELP, "artifacts"),
help=ARTIFACTS_HELP, help=ARTIFACTS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
artifacts_subparsers = artifacts_parser.add_subparsers( artifacts_subparsers = artifacts_parser.add_subparsers(
dest="cmd", dest="cmd",
@@ -61,7 +59,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(ARTIFACTS_GET_HELP, "artifacts/get"), description=append_doc_link(ARTIFACTS_GET_HELP, "artifacts/get"),
help=ARTIFACTS_HELP, help=ARTIFACTS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
get_parser.add_argument("url", help="Location of DVC repository to download from") get_parser.add_argument("url", help="Location of DVC repository to download from")
get_parser.add_argument( get_parser.add_argument(
+4 -4
View File
@@ -1,7 +1,7 @@
import argparse import argparse
import os import os
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.commands.config import CmdConfig from dvc.commands.config import CmdConfig
@@ -58,7 +58,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(CACHE_HELP, "cache"), description=append_doc_link(CACHE_HELP, "cache"),
help=CACHE_HELP, help=CACHE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
cache_subparsers = cache_parser.add_subparsers( cache_subparsers = cache_parser.add_subparsers(
@@ -76,7 +76,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser, parent_cache_config_parser], parents=[parent_parser, parent_cache_config_parser],
description=append_doc_link(CACHE_HELP, "cache/dir"), description=append_doc_link(CACHE_HELP, "cache/dir"),
help=CACHE_DIR_HELP, help=CACHE_DIR_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
cache_dir_parser.add_argument( cache_dir_parser.add_argument(
"-u", "-u",
@@ -103,7 +103,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(CACHE_HELP, "cache/migrate"), description=append_doc_link(CACHE_HELP, "cache/migrate"),
help=CACHE_MIGRATE_HELP, help=CACHE_MIGRATE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
cache_migrate_parser.add_argument( cache_migrate_parser.add_argument(
"--dvc-files", "--dvc-files",
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.ui import ui from dvc.ui import ui
@@ -85,7 +83,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(ADD_HELP, "check-ignore"), description=append_doc_link(ADD_HELP, "check-ignore"),
help=ADD_HELP, help=ADD_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
parser.add_argument( parser.add_argument(
"-d", "-d",
+2 -3
View File
@@ -1,7 +1,6 @@
import argparse
import operator import operator
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import CheckoutError from dvc.exceptions import CheckoutError
@@ -67,7 +66,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(CHECKOUT_HELP, "checkout"), description=append_doc_link(CHECKOUT_HELP, "checkout"),
help=CHECKOUT_HELP, help=CHECKOUT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
checkout_parser.add_argument( checkout_parser.add_argument(
"--summary", "--summary",
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -40,7 +38,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(COMMIT_HELP, "commit"), description=append_doc_link(COMMIT_HELP, "commit"),
help=COMMIT_HELP, help=COMMIT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
commit_parser.add_argument( commit_parser.add_argument(
"-f", "-f",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.completion import PREAMBLE from dvc.cli.completion import PREAMBLE
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
@@ -31,7 +30,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(COMPLETION_DESCRIPTION, "completion"), description=append_doc_link(COMPLETION_DESCRIPTION, "completion"),
help=COMPLETION_HELP, help=COMPLETION_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
completion_parser.add_argument( completion_parser.add_argument(
"-s", "-s",
+2 -1
View File
@@ -3,6 +3,7 @@ import os
from funcy import set_in from funcy import set_in
from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -209,7 +210,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(CONFIG_HELP, "config"), description=append_doc_link(CONFIG_HELP, "config"),
help=CONFIG_HELP, help=CONFIG_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
config_parser.add_argument( config_parser.add_argument(
"-u", "-u",
+2 -2
View File
@@ -1,6 +1,6 @@
import argparse
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.ui import ui from dvc.ui import ui
@@ -160,7 +160,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(DAG_HELP, "dag"), description=append_doc_link(DAG_HELP, "dag"),
help=DAG_HELP, help=DAG_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
dag_parser.add_argument( dag_parser.add_argument(
"--dot", "--dot",
+3 -3
View File
@@ -1,8 +1,8 @@
import argparse
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
from funcy import chunks, compact, log_durations from funcy import chunks, compact, log_durations
from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.log import logger from dvc.log import logger
@@ -129,7 +129,7 @@ def add_parser(subparsers, parent_parser):
data_parser = subparsers.add_parser( data_parser = subparsers.add_parser(
"data", "data",
parents=[parent_parser], parents=[parent_parser],
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
data_subparsers = data_parser.add_subparsers( data_subparsers = data_parser.add_subparsers(
dest="cmd", dest="cmd",
@@ -144,7 +144,7 @@ def add_parser(subparsers, parent_parser):
"status", "status",
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(DATA_STATUS_HELP, "data/status"), description=append_doc_link(DATA_STATUS_HELP, "data/status"),
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
help=DATA_STATUS_HELP, help=DATA_STATUS_HELP,
) )
data_status_parser.add_argument( data_status_parser.add_argument(
+5 -5
View File
@@ -1,6 +1,6 @@
import argparse import argparse
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -145,7 +145,7 @@ def add_parser(subparsers, _parent_parser):
parents=[shared_parent_parser()], parents=[shared_parent_parser()],
description=append_doc_link(PULL_HELP, "pull"), description=append_doc_link(PULL_HELP, "pull"),
help=PULL_HELP, help=PULL_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
pull_parser.add_argument( pull_parser.add_argument(
"-r", "--remote", help="Remote storage to pull from", metavar="<name>" "-r", "--remote", help="Remote storage to pull from", metavar="<name>"
@@ -220,7 +220,7 @@ def add_parser(subparsers, _parent_parser):
parents=[shared_parent_parser()], parents=[shared_parent_parser()],
description=append_doc_link(PUSH_HELP, "push"), description=append_doc_link(PUSH_HELP, "push"),
help=PUSH_HELP, help=PUSH_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
push_parser.add_argument( push_parser.add_argument(
"-r", "--remote", help="Remote storage to push to", metavar="<name>" "-r", "--remote", help="Remote storage to push to", metavar="<name>"
@@ -282,7 +282,7 @@ def add_parser(subparsers, _parent_parser):
parents=[shared_parent_parser()], parents=[shared_parent_parser()],
description=append_doc_link(FETCH_HELP, "fetch"), description=append_doc_link(FETCH_HELP, "fetch"),
help=FETCH_HELP, help=FETCH_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
fetch_parser.add_argument( fetch_parser.add_argument(
"-r", "--remote", help="Remote storage to fetch from", metavar="<name>" "-r", "--remote", help="Remote storage to fetch from", metavar="<name>"
@@ -355,7 +355,7 @@ def add_parser(subparsers, _parent_parser):
description=append_doc_link(STATUS_HELP, "status"), description=append_doc_link(STATUS_HELP, "status"),
help=STATUS_HELP, help=STATUS_HELP,
conflict_handler="resolve", conflict_handler="resolve",
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
status_parser.add_argument( status_parser.add_argument(
"-q", "-q",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -41,7 +40,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(DESTROY_HELP, "destroy"), description=append_doc_link(DESTROY_HELP, "destroy"),
help=DESTROY_HELP, help=DESTROY_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
destroy_parser.add_argument( destroy_parser.add_argument(
"-f", "-f",
+2 -3
View File
@@ -1,7 +1,6 @@
import argparse
import os import os
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -163,7 +162,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(DIFF_DESCRIPTION, "diff"), description=append_doc_link(DIFF_DESCRIPTION, "diff"),
help=DIFF_DESCRIPTION, help=DIFF_DESCRIPTION,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
diff_parser.add_argument( diff_parser.add_argument(
"--targets", "--targets",
+2 -3
View File
@@ -1,7 +1,6 @@
import argparse
import logging import logging
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.ui import ui from dvc.ui import ui
@@ -34,7 +33,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(DU_HELP, "du"), description=append_doc_link(DU_HELP, "du"),
help=DU_HELP, help=DU_HELP,
formatter_class=argparse.RawTextHelpFormatter, formatter_class=formatter.RawTextHelpFormatter,
) )
du_parser.add_argument("url", help="Location of DVC repository") du_parser.add_argument("url", help="Location of DVC repository")
du_parser.add_argument( du_parser.add_argument(
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.utils import append_doc_link, fix_subparsers, hide_subparsers_from_help from dvc.cli.utils import append_doc_link, fix_subparsers, hide_subparsers_from_help
from dvc.commands.experiments import ( from dvc.commands.experiments import (
apply, apply,
@@ -44,7 +43,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
aliases=["exp"], aliases=["exp"],
description=append_doc_link(EXPERIMENTS_HELP, "exp"), description=append_doc_link(EXPERIMENTS_HELP, "exp"),
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
help=EXPERIMENTS_HELP, help=EXPERIMENTS_HELP,
) )
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -30,7 +28,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_APPLY_HELP, "exp/apply"), description=append_doc_link(EXPERIMENTS_APPLY_HELP, "exp/apply"),
help=EXPERIMENTS_APPLY_HELP, help=EXPERIMENTS_APPLY_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
experiments_apply_parser.add_argument( experiments_apply_parser.add_argument(
"--no-force", "--no-force",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -21,7 +20,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_BRANCH_HELP, "exp/branch"), description=append_doc_link(EXPERIMENTS_BRANCH_HELP, "exp/branch"),
help=EXPERIMENTS_BRANCH_HELP, help=EXPERIMENTS_BRANCH_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
experiments_branch_parser.add_argument( experiments_branch_parser.add_argument(
"experiment", help="Experiment to be promoted." "experiment", help="Experiment to be promoted."
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -20,6 +19,6 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_CLEAN_HELP, "exp/clean"), description=append_doc_link(EXPERIMENTS_CLEAN_HELP, "exp/clean"),
help=EXPERIMENTS_CLEAN_HELP, help=EXPERIMENTS_CLEAN_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
experiments_clean_parser.set_defaults(func=CmdExperimentsClean) experiments_clean_parser.set_defaults(func=CmdExperimentsClean)
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.commands.metrics import DEFAULT_PRECISION from dvc.commands.metrics import DEFAULT_PRECISION
@@ -59,7 +57,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_DIFF_HELP, "exp/diff"), description=append_doc_link(EXPERIMENTS_DIFF_HELP, "exp/diff"),
help=EXPERIMENTS_DIFF_HELP, help=EXPERIMENTS_DIFF_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
experiments_diff_parser.add_argument( experiments_diff_parser.add_argument(
"a_rev", nargs="?", help="Old experiment to compare (defaults to HEAD)" "a_rev", nargs="?", help="Old experiment to compare (defaults to HEAD)"
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import InvalidArgumentError from dvc.exceptions import InvalidArgumentError
@@ -63,7 +62,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_LIST_HELP, "exp/list"), description=append_doc_link(EXPERIMENTS_LIST_HELP, "exp/list"),
help=EXPERIMENTS_LIST_HELP, help=EXPERIMENTS_LIST_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
add_rev_selection_flags(experiments_list_parser, "List") add_rev_selection_flags(experiments_list_parser, "List")
display_group = experiments_list_parser.add_mutually_exclusive_group() display_group = experiments_list_parser.add_mutually_exclusive_group()
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -49,7 +48,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_PULL_HELP, "exp/pull"), description=append_doc_link(EXPERIMENTS_PULL_HELP, "exp/pull"),
help=EXPERIMENTS_PULL_HELP, help=EXPERIMENTS_PULL_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
add_rev_selection_flags(experiments_pull_parser, "Pull", True) add_rev_selection_flags(experiments_pull_parser, "Pull", True)
experiments_pull_parser.add_argument( experiments_pull_parser.add_argument(
+2 -3
View File
@@ -1,7 +1,6 @@
import argparse
from typing import Any, Dict from typing import Any, Dict
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -90,7 +89,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_PUSH_HELP, "exp/push"), description=append_doc_link(EXPERIMENTS_PUSH_HELP, "exp/push"),
help=EXPERIMENTS_PUSH_HELP, help=EXPERIMENTS_PUSH_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
add_rev_selection_flags(experiments_push_parser, "Push", True) add_rev_selection_flags(experiments_push_parser, "Push", True)
experiments_push_parser.add_argument( experiments_push_parser.add_argument(
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import InvalidArgumentError from dvc.exceptions import InvalidArgumentError
@@ -54,7 +53,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_REMOVE_HELP, "exp/remove"), description=append_doc_link(EXPERIMENTS_REMOVE_HELP, "exp/remove"),
help=EXPERIMENTS_REMOVE_HELP, help=EXPERIMENTS_REMOVE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remove_group = experiments_remove_parser.add_mutually_exclusive_group() remove_group = experiments_remove_parser.add_mutually_exclusive_group()
add_rev_selection_flags(experiments_remove_parser, "Remove", False) add_rev_selection_flags(experiments_remove_parser, "Remove", False)
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import InvalidArgumentError from dvc.exceptions import InvalidArgumentError
@@ -38,7 +37,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_RENAME_HELP, "exp/rename"), description=append_doc_link(EXPERIMENTS_RENAME_HELP, "exp/rename"),
help=EXPERIMENTS_RENAME_HELP, help=EXPERIMENTS_RENAME_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
rename_group = experiments_rename_parser.add_mutually_exclusive_group() rename_group = experiments_rename_parser.add_mutually_exclusive_group()
rename_group.add_argument( rename_group.add_argument(
+2 -1
View File
@@ -1,5 +1,6 @@
import argparse import argparse
from dvc.cli import formatter
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.commands.repro import CmdRepro from dvc.commands.repro import CmdRepro
from dvc.commands.repro import add_arguments as add_repro_arguments from dvc.commands.repro import add_arguments as add_repro_arguments
@@ -32,7 +33,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_RUN_HELP, "exp/run"), description=append_doc_link(EXPERIMENTS_RUN_HELP, "exp/run"),
help=EXPERIMENTS_RUN_HELP, help=EXPERIMENTS_RUN_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
_add_run_common(experiments_run_parser) _add_run_common(experiments_run_parser)
experiments_run_parser.set_defaults(func=CmdExperimentsRun) experiments_run_parser.set_defaults(func=CmdExperimentsRun)
+2 -1
View File
@@ -1,5 +1,6 @@
import argparse import argparse
from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -38,7 +39,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_SAVE_HELP, "exp/save"), description=append_doc_link(EXPERIMENTS_SAVE_HELP, "exp/save"),
help=EXPERIMENTS_SAVE_HELP, help=EXPERIMENTS_SAVE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
save_parser.add_argument( save_parser.add_argument(
"-f", "-f",
+2 -1
View File
@@ -5,6 +5,7 @@ from typing import TYPE_CHECKING, Dict, Iterable
from funcy import lmap from funcy import lmap
from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.commands.metrics import DEFAULT_PRECISION from dvc.commands.metrics import DEFAULT_PRECISION
@@ -200,7 +201,7 @@ def add_parser(experiments_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(EXPERIMENTS_SHOW_HELP, "exp/show"), description=append_doc_link(EXPERIMENTS_SHOW_HELP, "exp/show"),
help=EXPERIMENTS_SHOW_HELP, help=EXPERIMENTS_SHOW_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
add_rev_selection_flags(experiments_show_parser, "Show") add_rev_selection_flags(experiments_show_parser, "Show")
experiments_show_parser.add_argument( experiments_show_parser.add_argument(
+3 -5
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -38,7 +36,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(FREEZE_HELP, "freeze"), description=append_doc_link(FREEZE_HELP, "freeze"),
help=FREEZE_HELP, help=FREEZE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
freeze_parser.add_argument( freeze_parser.add_argument(
"targets", nargs="+", help="Stages or .dvc files to freeze" "targets", nargs="+", help="Stages or .dvc files to freeze"
@@ -51,7 +49,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(UNFREEZE_HELP, "unfreeze"), description=append_doc_link(UNFREEZE_HELP, "unfreeze"),
help=UNFREEZE_HELP, help=UNFREEZE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
unfreeze_parser.add_argument( unfreeze_parser.add_argument(
"targets", nargs="+", help="Stages or .dvc files to unfreeze" "targets", nargs="+", help="Stages or .dvc files to unfreeze"
+4 -4
View File
@@ -1,6 +1,6 @@
import argparse
import os import os
from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -102,7 +102,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(GC_DESCRIPTION, "gc"), description=append_doc_link(GC_DESCRIPTION, "gc"),
help=GC_HELP, help=GC_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
gc_parser.add_argument( gc_parser.add_argument(
"-w", "-w",
@@ -156,12 +156,12 @@ def add_parser(subparsers, parent_parser):
"--date", "--date",
type=str, type=str,
dest="commit_date", dest="commit_date",
metavar="<YYYY-MM-DD>", metavar="<yyyy-mm-dd>",
default=None, default=None,
help=( help=(
"Keep cached data referenced in the commits after ( inclusive )" "Keep cached data referenced in the commits after ( inclusive )"
" a certain time. Date must match the extended ISO 8601 format " " a certain time. Date must match the extended ISO 8601 format "
"(YYYY-MM-DD)." "(yyyy-mm-dd)."
), ),
) )
gc_parser.add_argument( gc_parser.add_argument(
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -59,7 +57,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(GET_HELP, "get"), description=append_doc_link(GET_HELP, "get"),
help=GET_HELP, help=GET_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
get_parser.add_argument( get_parser.add_argument(
"url", help="Location of DVC or Git repository to download from" "url", help="Location of DVC or Git repository to download from"
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -36,7 +34,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(GET_HELP, "get-url"), description=append_doc_link(GET_HELP, "get-url"),
help=GET_HELP, help=GET_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
get_parser.add_argument( get_parser.add_argument(
"url", help="See `dvc import-url -h` for full list of supported URLs." "url", help="See `dvc import-url -h` for full list of supported URLs."
+2
View File
@@ -1,5 +1,6 @@
import os import os
from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import fix_subparsers from dvc.cli.utils import fix_subparsers
from dvc.exceptions import NotDvcRepoError from dvc.exceptions import NotDvcRepoError
@@ -140,6 +141,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=MERGE_DRIVER_HELP, description=MERGE_DRIVER_HELP,
help=MERGE_DRIVER_HELP, help=MERGE_DRIVER_HELP,
formatter_class=formatter.HelpFormatter,
) )
merge_driver_parser.add_argument( merge_driver_parser.add_argument(
"--ancestor", "--ancestor",
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -51,7 +49,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(IMPORT_HELP, "import"), description=append_doc_link(IMPORT_HELP, "import"),
help=IMPORT_HELP, help=IMPORT_HELP,
formatter_class=argparse.RawTextHelpFormatter, formatter_class=formatter.RawTextHelpFormatter,
) )
import_parser.add_argument( import_parser.add_argument(
"url", help="Location of DVC or Git repository to download from" "url", help="Location of DVC or Git repository to download from"
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase, CmdBaseNoRepo from dvc.cli.command import CmdBase, CmdBaseNoRepo
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -53,7 +51,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(IMPORT_HELP, "import-db"), description=append_doc_link(IMPORT_HELP, "import-db"),
help=IMPORT_HELP, help=IMPORT_HELP,
formatter_class=argparse.RawTextHelpFormatter, formatter_class=formatter.RawTextHelpFormatter,
) )
group = import_parser.add_mutually_exclusive_group(required=True) group = import_parser.add_mutually_exclusive_group(required=True)
group.add_argument("--sql", help="SQL query to snapshot", metavar="sql") group.add_argument("--sql", help="SQL query to snapshot", metavar="sql")
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -44,7 +42,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(IMPORT_HELP, "import-url"), description=append_doc_link(IMPORT_HELP, "import-url"),
help=IMPORT_HELP, help=IMPORT_HELP,
formatter_class=argparse.RawTextHelpFormatter, formatter_class=formatter.RawTextHelpFormatter,
) )
import_parser.add_argument( import_parser.add_argument(
"url", "url",
+2 -3
View File
@@ -1,8 +1,7 @@
import argparse
import colorama import colorama
from dvc import analytics from dvc import analytics
from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -69,7 +68,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(INIT_DESCRIPTION, "init"), description=append_doc_link(INIT_DESCRIPTION, "init"),
help=INIT_HELP, help=INIT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
init_parser.add_argument( init_parser.add_argument(
"--no-scm", "--no-scm",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -25,7 +24,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(INSTALL_HELP, "install"), description=append_doc_link(INSTALL_HELP, "install"),
help=INSTALL_HELP, help=INSTALL_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
install_parser.add_argument( install_parser.add_argument(
"--use-pre-commit-tool", "--use-pre-commit-tool",
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.commands.ls.ls_colors import LsColors from dvc.commands.ls.ls_colors import LsColors
@@ -75,7 +73,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(LIST_HELP, "list"), description=append_doc_link(LIST_HELP, "list"),
help=LIST_HELP, help=LIST_HELP,
formatter_class=argparse.RawTextHelpFormatter, formatter_class=formatter.RawTextHelpFormatter,
) )
list_parser.add_argument("url", help="Location of DVC repository to list") list_parser.add_argument("url", help="Location of DVC repository to list")
list_parser.add_argument( list_parser.add_argument(
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import DictAction, append_doc_link from dvc.cli.utils import DictAction, append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -33,7 +32,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(LS_HELP, "list-url"), description=append_doc_link(LS_HELP, "list-url"),
help=LS_HELP, help=LS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
lsurl_parser.add_argument( lsurl_parser.add_argument(
"url", help="See `dvc import-url -h` for full list of supported URLs." "url", help="See `dvc import-url -h` for full list of supported URLs."
+4 -6
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.log import logger from dvc.log import logger
@@ -107,7 +105,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(METRICS_HELP, "metrics"), description=append_doc_link(METRICS_HELP, "metrics"),
help=METRICS_HELP, help=METRICS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
metrics_subparsers = metrics_parser.add_subparsers( metrics_subparsers = metrics_parser.add_subparsers(
@@ -123,7 +121,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(METRICS_SHOW_HELP, "metrics/show"), description=append_doc_link(METRICS_SHOW_HELP, "metrics/show"),
help=METRICS_SHOW_HELP, help=METRICS_SHOW_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
metrics_show_parser.add_argument( metrics_show_parser.add_argument(
"targets", "targets",
@@ -197,7 +195,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(METRICS_DIFF_HELP, "metrics/diff"), description=append_doc_link(METRICS_DIFF_HELP, "metrics/diff"),
help=METRICS_DIFF_HELP, help=METRICS_DIFF_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
metrics_diff_parser.add_argument( metrics_diff_parser.add_argument(
"a_rev", "a_rev",
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -34,7 +32,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(MOVE_DESCRIPTION, "move"), description=append_doc_link(MOVE_DESCRIPTION, "move"),
help=MOVE_HELP, help=MOVE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
move_parser.add_argument( move_parser.add_argument(
"src", help="Source path to a data file or directory." "src", help="Source path to a data file or directory."
+3 -5
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.log import logger from dvc.log import logger
@@ -61,7 +59,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(PARAMS_HELP, "params"), description=append_doc_link(PARAMS_HELP, "params"),
help=PARAMS_HELP, help=PARAMS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
params_subparsers = params_parser.add_subparsers( params_subparsers = params_parser.add_subparsers(
@@ -80,7 +78,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(PARAMS_DIFF_HELP, "params/diff"), description=append_doc_link(PARAMS_DIFF_HELP, "params/diff"),
help=PARAMS_DIFF_HELP, help=PARAMS_DIFF_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
params_diff_parser.add_argument( params_diff_parser.add_argument(
"a_rev", "a_rev",
+6 -6
View File
@@ -4,7 +4,7 @@ from typing import TYPE_CHECKING, Dict, List, Optional
from funcy import compact, first, get_in from funcy import compact, first, get_in
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -223,7 +223,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(PLOTS_HELP, "plots"), description=append_doc_link(PLOTS_HELP, "plots"),
help=PLOTS_HELP, help=PLOTS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
plots_subparsers = plots_parser.add_subparsers( plots_subparsers = plots_parser.add_subparsers(
dest="cmd", dest="cmd",
@@ -240,7 +240,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(SHOW_HELP, "plots/show"), description=append_doc_link(SHOW_HELP, "plots/show"),
help=SHOW_HELP, help=SHOW_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
plots_show_parser.add_argument( plots_show_parser.add_argument(
"targets", "targets",
@@ -263,7 +263,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(PLOTS_DIFF_HELP, "plots/diff"), description=append_doc_link(PLOTS_DIFF_HELP, "plots/diff"),
help=PLOTS_DIFF_HELP, help=PLOTS_DIFF_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
plots_diff_parser.add_argument( plots_diff_parser.add_argument(
"--targets", "--targets",
@@ -299,7 +299,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(PLOTS_MODIFY_HELP, "plots/modify"), description=append_doc_link(PLOTS_MODIFY_HELP, "plots/modify"),
help=PLOTS_MODIFY_HELP, help=PLOTS_MODIFY_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
plots_modify_parser.add_argument( plots_modify_parser.add_argument(
"target", "target",
@@ -320,7 +320,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(TEMPLATES_HELP, "plots/templates"), description=append_doc_link(TEMPLATES_HELP, "plots/templates"),
help=TEMPLATES_HELP, help=TEMPLATES_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
plots_templates_parser.add_argument( plots_templates_parser.add_argument(
"template", "template",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.commands.queue import kill, logs, remove, start, status, stop from dvc.commands.queue import kill, logs, remove, start, status, stop
@@ -20,7 +19,7 @@ def add_parser(subparsers, parent_parser):
"queue", "queue",
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_HELP, "queue"), description=append_doc_link(QUEUE_HELP, "queue"),
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
help=QUEUE_HELP, help=QUEUE_HELP,
) )
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -27,7 +26,7 @@ def add_parser(queue_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_KILL_HELP, "queue/kill"), description=append_doc_link(QUEUE_KILL_HELP, "queue/kill"),
help=QUEUE_KILL_HELP, help=QUEUE_KILL_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
queue_kill_parser.add_argument( queue_kill_parser.add_argument(
"-f", "-f",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -29,7 +28,7 @@ def add_parser(queue_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_LOGS_HELP, "queue/logs"), description=append_doc_link(QUEUE_LOGS_HELP, "queue/logs"),
help=QUEUE_LOGS_HELP, help=QUEUE_LOGS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
queue_logs_parser.add_argument( queue_logs_parser.add_argument(
"-e", "-e",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import InvalidArgumentError from dvc.exceptions import InvalidArgumentError
@@ -62,7 +61,7 @@ def add_parser(queue_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_REMOVE_HELP, "queue/remove"), description=append_doc_link(QUEUE_REMOVE_HELP, "queue/remove"),
help=QUEUE_REMOVE_HELP, help=QUEUE_REMOVE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
queue_remove_parser.add_argument( queue_remove_parser.add_argument(
"--all", "--all",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -27,7 +26,7 @@ def add_parser(queue_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_START_HELP, "queue/start"), description=append_doc_link(QUEUE_START_HELP, "queue/start"),
help=QUEUE_START_HELP, help=QUEUE_START_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
queue_start_parser.add_argument( queue_start_parser.add_argument(
"-j", "-j",
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.compare import TabularData from dvc.compare import TabularData
@@ -52,6 +51,6 @@ def add_parser(queue_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_STATUS_HELP, "queue/status"), description=append_doc_link(QUEUE_STATUS_HELP, "queue/status"),
help=QUEUE_STATUS_HELP, help=QUEUE_STATUS_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
queue_status_parser.set_defaults(func=CmdQueueStatus) queue_status_parser.set_defaults(func=CmdQueueStatus)
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -32,7 +31,7 @@ def add_parser(queue_subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(QUEUE_STOP_HELP, "queue/stop"), description=append_doc_link(QUEUE_STOP_HELP, "queue/stop"),
help=QUEUE_STOP_HELP, help=QUEUE_STOP_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
queue_stop_parser.add_argument( queue_stop_parser.add_argument(
"--kill", "--kill",
+8 -9
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.commands.config import CmdConfig from dvc.commands.config import CmdConfig
from dvc.ui import ui from dvc.ui import ui
@@ -155,7 +154,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(REMOTE_HELP, "remote"), description=append_doc_link(REMOTE_HELP, "remote"),
help=REMOTE_HELP, help=REMOTE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_subparsers = remote_parser.add_subparsers( remote_subparsers = remote_parser.add_subparsers(
@@ -171,7 +170,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(REMOTE_ADD_HELP, "remote/add"), description=append_doc_link(REMOTE_ADD_HELP, "remote/add"),
help=REMOTE_ADD_HELP, help=REMOTE_ADD_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_add_parser.add_argument("name", help="Name of the remote") remote_add_parser.add_argument("name", help="Name of the remote")
remote_add_parser.add_argument( remote_add_parser.add_argument(
@@ -202,7 +201,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(REMOTE_DEFAULT_HELP, "remote/default"), description=append_doc_link(REMOTE_DEFAULT_HELP, "remote/default"),
help=REMOTE_DEFAULT_HELP, help=REMOTE_DEFAULT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_default_parser.add_argument("name", nargs="?", help="Name of the remote") remote_default_parser.add_argument("name", nargs="?", help="Name of the remote")
remote_default_parser.add_argument( remote_default_parser.add_argument(
@@ -220,7 +219,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(REMOTE_MODIFY_HELP, "remote/modify"), description=append_doc_link(REMOTE_MODIFY_HELP, "remote/modify"),
help=REMOTE_MODIFY_HELP, help=REMOTE_MODIFY_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_modify_parser.add_argument("name", help="Name of the remote") 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("option", help="Name of the option to modify.")
@@ -242,7 +241,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(REMOTE_LIST_HELP, "remote/list"), description=append_doc_link(REMOTE_LIST_HELP, "remote/list"),
help=REMOTE_LIST_HELP, help=REMOTE_LIST_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_list_parser.set_defaults(func=CmdRemoteList) remote_list_parser.set_defaults(func=CmdRemoteList)
@@ -252,7 +251,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(REMOTE_REMOVE_HELP, "remote/remove"), description=append_doc_link(REMOTE_REMOVE_HELP, "remote/remove"),
help=REMOTE_REMOVE_HELP, help=REMOTE_REMOVE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_remove_parser.add_argument("name", help="Name of the remote to remove.") remote_remove_parser.add_argument("name", help="Name of the remote to remove.")
remote_remove_parser.set_defaults(func=CmdRemoteRemove) remote_remove_parser.set_defaults(func=CmdRemoteRemove)
@@ -262,7 +261,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_config_parser, parent_parser], parents=[parent_config_parser, parent_parser],
description=append_doc_link(REMOTE_RENAME_HELP, "remote/rename"), description=append_doc_link(REMOTE_RENAME_HELP, "remote/rename"),
help=REMOTE_RENAME_HELP, help=REMOTE_RENAME_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remote_rename_parser.add_argument("name", help="Remote to be renamed") 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.add_argument("new", help="New name of the remote")
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -30,7 +28,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(REMOVE_HELP, "remove"), description=append_doc_link(REMOVE_HELP, "remove"),
help=REMOVE_HELP, help=REMOVE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
remove_parser.add_argument( remove_parser.add_argument(
"--outs", "--outs",
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.commands.status import CmdDataStatus from dvc.commands.status import CmdDataStatus
@@ -167,7 +165,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(REPRO_HELP, "repro"), description=append_doc_link(REPRO_HELP, "repro"),
help=REPRO_HELP, help=REPRO_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
# repro/exp run shared args # repro/exp run shared args
add_arguments(repro_parser) add_arguments(repro_parser)
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -24,6 +23,6 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(ROOT_HELP, "root"), description=append_doc_link(ROOT_HELP, "root"),
help=ROOT_HELP, help=ROOT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
root_parser.set_defaults(func=CmdRoot) root_parser.set_defaults(func=CmdRoot)
+4 -4
View File
@@ -4,7 +4,7 @@ from contextlib import contextmanager
from itertools import chain, filterfalse from itertools import chain, filterfalse
from typing import TYPE_CHECKING, Dict, Iterable, List from typing import TYPE_CHECKING, Dict, Iterable, List
from dvc.cli import completion from dvc.cli import completion, formatter
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.log import logger from dvc.log import logger
@@ -284,7 +284,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STAGES_HELP, "stage"), description=append_doc_link(STAGES_HELP, "stage"),
help=STAGES_HELP, help=STAGES_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
stage_subparsers = stage_parser.add_subparsers( stage_subparsers = stage_parser.add_subparsers(
@@ -300,7 +300,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STAGE_ADD_HELP, "stage/add"), description=append_doc_link(STAGE_ADD_HELP, "stage/add"),
help=STAGE_ADD_HELP, help=STAGE_ADD_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
stage_add_parser.add_argument( stage_add_parser.add_argument(
"-n", "--name", help="Name of the stage to add", required=True "-n", "--name", help="Name of the stage to add", required=True
@@ -314,7 +314,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STAGE_LIST_HELP, "stage/list"), description=append_doc_link(STAGE_LIST_HELP, "stage/list"),
help=STAGE_LIST_HELP, help=STAGE_LIST_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
stage_list_parser.add_argument( stage_list_parser.add_argument(
"targets", "targets",
+5 -5
View File
@@ -1,8 +1,8 @@
import argparse
import os import os
from funcy import get_in from funcy import get_in
from dvc.cli import formatter
from dvc.cli.utils import append_doc_link, fix_subparsers from dvc.cli.utils import append_doc_link, fix_subparsers
from dvc.commands.config import CmdConfig from dvc.commands.config import CmdConfig
from dvc.log import logger from dvc.log import logger
@@ -92,7 +92,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STUDIO_DESCRIPTION, "studio"), description=append_doc_link(STUDIO_DESCRIPTION, "studio"),
help=STUDIO_HELP, help=STUDIO_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
studio_subparser = studio_parser.add_subparsers( studio_subparser = studio_parser.add_subparsers(
dest="cmd", dest="cmd",
@@ -110,7 +110,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STUDIO_LOGIN_DESCRIPTION, "studio/login"), description=append_doc_link(STUDIO_LOGIN_DESCRIPTION, "studio/login"),
help=STUDIO_LOGIN_HELP, help=STUDIO_LOGIN_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
login_parser.add_argument( login_parser.add_argument(
@@ -157,7 +157,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STUDIO_LOGOUT_DESCRIPTION, "studio/logout"), description=append_doc_link(STUDIO_LOGOUT_DESCRIPTION, "studio/logout"),
help=STUDIO_LOGOUT_HELP, help=STUDIO_LOGOUT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
logout_parser.set_defaults(func=CmdStudioLogout) logout_parser.set_defaults(func=CmdStudioLogout)
@@ -169,7 +169,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(STUDIO_TOKEN_HELP, "studio/token"), description=append_doc_link(STUDIO_TOKEN_HELP, "studio/token"),
help=STUDIO_TOKEN_HELP, help=STUDIO_TOKEN_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
logout_parser.set_defaults(func=CmdStudioToken) logout_parser.set_defaults(func=CmdStudioToken)
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -31,7 +29,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(UNPROTECT_HELP, "unprotect"), description=append_doc_link(UNPROTECT_HELP, "unprotect"),
help=UNPROTECT_HELP, help=UNPROTECT_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
unprotect_parser.add_argument( unprotect_parser.add_argument(
"targets", nargs="+", help="Data files/directories to unprotect." "targets", nargs="+", help="Data files/directories to unprotect."
+2 -4
View File
@@ -1,6 +1,4 @@
import argparse from dvc.cli import completion, formatter
from dvc.cli import completion
from dvc.cli.command import CmdBase from dvc.cli.command import CmdBase
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.exceptions import DvcException from dvc.exceptions import DvcException
@@ -38,7 +36,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(UPDATE_HELP, "update"), description=append_doc_link(UPDATE_HELP, "update"),
help=UPDATE_HELP, help=UPDATE_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
) )
update_parser.add_argument( update_parser.add_argument(
"targets", nargs="+", help=".dvc files to update." "targets", nargs="+", help=".dvc files to update."
+2 -3
View File
@@ -1,5 +1,4 @@
import argparse from dvc.cli import formatter
from dvc.cli.command import CmdBaseNoRepo from dvc.cli.command import CmdBaseNoRepo
from dvc.cli.utils import append_doc_link from dvc.cli.utils import append_doc_link
from dvc.log import logger from dvc.log import logger
@@ -27,7 +26,7 @@ def add_parser(subparsers, parent_parser):
parents=[parent_parser], parents=[parent_parser],
description=append_doc_link(VERSION_HELP, "version"), description=append_doc_link(VERSION_HELP, "version"),
help=VERSION_HELP, help=VERSION_HELP,
formatter_class=argparse.RawDescriptionHelpFormatter, formatter_class=formatter.RawDescriptionHelpFormatter,
aliases=["doctor"], aliases=["doctor"],
) )
version_parser.set_defaults(func=CmdVersion) version_parser.set_defaults(func=CmdVersion)
+16
View File
@@ -1,5 +1,7 @@
import logging import logging
import re
from argparse import SUPPRESS, ArgumentParser from argparse import SUPPRESS, ArgumentParser
from itertools import takewhile
from typing import Tuple from typing import Tuple
import pytest import pytest
@@ -44,5 +46,19 @@ def test_help(caplog, capsys, command_tuples):
assert not caplog.text assert not caplog.text
out, err = capsys.readouterr() out, err = capsys.readouterr()
# validate metavars are all in lowercase
usage = "\n".join(takewhile(lambda o: bool(o), out.splitlines()))
message = (
"metavars not lowercased, you are likely missing formatter_class=XXX "
"in the command, where XXX should be any of the classes from "
"`dvc.cli.formatter`, which automatically lowercases metavars.\n"
"\nExample:\n"
"\nfrom dvc.cli import formatter\n"
"\nparser.add_parser(..., formatter_class=formatter.TextHelpFormatter)\n"
)
assert not re.findall(r"\b[A-Z]{2,}\b", usage, re.MULTILINE), message
assert not err assert not err
assert out assert out