From 732e30abe18ccfe1051def0f1a737cbc6b1ac950 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 21 Jun 2020 00:32:05 +0100 Subject: [PATCH 1/2] command: add metavars - makes help output look the same as before #3921 --- dvc/command/add.py | 1 + dvc/command/cache.py | 1 + dvc/command/checkout.py | 1 + dvc/command/commit.py | 1 + dvc/command/daemon.py | 5 ++++- dvc/command/data_sync.py | 1 + dvc/command/freeze.py | 2 ++ dvc/command/get.py | 1 + dvc/command/get_url.py | 1 + dvc/command/imp.py | 1 + dvc/command/imp_url.py | 1 + dvc/command/ls/__init__.py | 1 + dvc/command/metrics.py | 1 + dvc/command/move.py | 6 +++++- dvc/command/plots.py | 2 ++ dvc/command/remove.py | 1 + dvc/command/repro.py | 1 + dvc/command/unprotect.py | 1 + dvc/command/update.py | 1 + 19 files changed, 28 insertions(+), 2 deletions(-) diff --git a/dvc/command/add.py b/dvc/command/add.py index 0131c982a7..59f6e728be 100644 --- a/dvc/command/add.py +++ b/dvc/command/add.py @@ -66,6 +66,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="+", help="Input files/directories to add.", + metavar="targets", choices=completion.Required.FILE, ) parser.set_defaults(func=CmdAdd) diff --git a/dvc/command/cache.py b/dvc/command/cache.py index 67a1215944..0de9aeede9 100644 --- a/dvc/command/cache.py +++ b/dvc/command/cache.py @@ -56,6 +56,7 @@ def add_parser(subparsers, parent_parser): help="Path to cache directory. Relative paths are resolved relative " "to the current directory and saved to config relative to the " "config file location.", + metavar="value", choices=completion.Required.DIR, ) cache_dir_parser.set_defaults(func=CmdCacheDir) diff --git a/dvc/command/checkout.py b/dvc/command/checkout.py index 13af05fe8a..2d30631ac6 100644 --- a/dvc/command/checkout.py +++ b/dvc/command/checkout.py @@ -114,6 +114,7 @@ def add_parser(subparsers, parent_parser): nargs="*", help="DVC-files to checkout. Optional. " "(Finds all DVC-files in the workspace by default.)", + metavar="targets", choices=completion.Optional.DVC_FILE, ) checkout_parser.set_defaults(func=CmdCheckout) diff --git a/dvc/command/commit.py b/dvc/command/commit.py index f20da2b1a2..56a4e66d51 100644 --- a/dvc/command/commit.py +++ b/dvc/command/commit.py @@ -67,6 +67,7 @@ def add_parser(subparsers, parent_parser): nargs="*", help="DVC-files to commit. Optional. " "(Finds all DVC-files in the workspace by default.)", + metavar="targets", choices=completion.Optional.DVC_FILE, ) commit_parser.set_defaults(func=CmdCommit) diff --git a/dvc/command/daemon.py b/dvc/command/daemon.py index 15ed9d6210..e7c977399f 100644 --- a/dvc/command/daemon.py +++ b/dvc/command/daemon.py @@ -66,6 +66,9 @@ def add_parser(subparsers, parent_parser): help=DAEMON_ANALYTICS_HELP, ) daemon_analytics_parser.add_argument( - "target", help="Analytics file.", choices=completion.Required.FILE + "target", + help="Analytics file.", + metavar="target", + choices=completion.Required.FILE, ) daemon_analytics_parser.set_defaults(func=CmdDaemonAnalytics) diff --git a/dvc/command/data_sync.py b/dvc/command/data_sync.py index ce883d30ab..a32e47c065 100644 --- a/dvc/command/data_sync.py +++ b/dvc/command/data_sync.py @@ -105,6 +105,7 @@ def shared_parent_parser(): nargs="*", help="Limit command scope to these DVC-files. " "Using -R, directories to search DVC-files in can also be given.", + metavar="targets", choices=completion.Optional.DVC_FILE, ) diff --git a/dvc/command/freeze.py b/dvc/command/freeze.py index 7505f11974..7c74eadf16 100644 --- a/dvc/command/freeze.py +++ b/dvc/command/freeze.py @@ -43,6 +43,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="+", help="DVC-files to freeze.", + metavar="targets", choices=completion.Required.DVC_FILE, ) freeze_parser.set_defaults(func=CmdFreeze) @@ -59,6 +60,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="+", help="DVC-files to unfreeze.", + metavar="targets", choices=completion.Required.DVC_FILE, ) unfreeze_parser.set_defaults(func=CmdUnfreeze) diff --git a/dvc/command/get.py b/dvc/command/get.py index 44170ea016..404aa3e48e 100644 --- a/dvc/command/get.py +++ b/dvc/command/get.py @@ -65,6 +65,7 @@ def add_parser(subparsers, parent_parser): get_parser.add_argument( "path", help="Path to a file or directory within the repository", + metavar="path", choices=completion.Required.FILE, ) get_parser.add_argument( diff --git a/dvc/command/get_url.py b/dvc/command/get_url.py index b40fac26ec..214b2739c4 100644 --- a/dvc/command/get_url.py +++ b/dvc/command/get_url.py @@ -37,6 +37,7 @@ def add_parser(subparsers, parent_parser): "out", nargs="?", help="Destination path to put data to.", + metavar="out", choices=completion.Optional.DIR, ) get_parser.set_defaults(func=CmdGetUrl) diff --git a/dvc/command/imp.py b/dvc/command/imp.py index 3e2f3dccaa..e11116ce60 100644 --- a/dvc/command/imp.py +++ b/dvc/command/imp.py @@ -46,6 +46,7 @@ def add_parser(subparsers, parent_parser): import_parser.add_argument( "path", help="Path to a file or directory within the repository", + metavar="path", choices=completion.Required.FILE, ) import_parser.add_argument( diff --git a/dvc/command/imp_url.py b/dvc/command/imp_url.py index 32d7876d4b..ea7c7290cd 100644 --- a/dvc/command/imp_url.py +++ b/dvc/command/imp_url.py @@ -61,6 +61,7 @@ def add_parser(subparsers, parent_parser): "out", nargs="?", help="Destination path to put files to.", + metavar="out", choices=completion.Optional.DIR, ) import_parser.add_argument( diff --git a/dvc/command/ls/__init__.py b/dvc/command/ls/__init__.py index ea18ed3548..a24d640907 100644 --- a/dvc/command/ls/__init__.py +++ b/dvc/command/ls/__init__.py @@ -75,6 +75,7 @@ def add_parser(subparsers, parent_parser): "path", nargs="?", help="Path to directory within the repository to list outputs for", + metavar="path", choices=completion.Optional.DIR, ) list_parser.set_defaults(func=CmdList) diff --git a/dvc/command/metrics.py b/dvc/command/metrics.py index 8e1e3ce43c..7d669b9036 100644 --- a/dvc/command/metrics.py +++ b/dvc/command/metrics.py @@ -170,6 +170,7 @@ def add_parser(subparsers, parent_parser): "Limit command scope to these metric files. Using -R, " "directories to search metric files in can also be given." ), + metavar="targets", choices=completion.Optional.FILE, ) metrics_show_parser.add_argument( diff --git a/dvc/command/move.py b/dvc/command/move.py index e0565754c8..0aae9999ed 100644 --- a/dvc/command/move.py +++ b/dvc/command/move.py @@ -39,9 +39,13 @@ def add_parser(subparsers, parent_parser): move_parser.add_argument( "src", help="Source path to a data file or directory.", + metavar="src", choices=completion.Required.FILE, ) move_parser.add_argument( - "dst", help="Destination path.", choices=completion.Required.FILE, + "dst", + help="Destination path.", + metavar="dst", + choices=completion.Required.FILE, ) move_parser.set_defaults(func=CmdMove) diff --git a/dvc/command/plots.py b/dvc/command/plots.py index 6c548dc21a..2a6d80d492 100644 --- a/dvc/command/plots.py +++ b/dvc/command/plots.py @@ -129,6 +129,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="*", help="Plots files to visualize. Shows all plots by default.", + metavar="targets", choices=completion.Optional.FILE, ) _add_props_arguments(plots_show_parser) @@ -171,6 +172,7 @@ def add_parser(subparsers, parent_parser): plots_modify_parser.add_argument( "target", help="Metric file to set properties to", + metavar="target", choices=completion.Required.FILE, ) _add_props_arguments(plots_modify_parser) diff --git a/dvc/command/remove.py b/dvc/command/remove.py index a76071b3fb..3eb083db87 100644 --- a/dvc/command/remove.py +++ b/dvc/command/remove.py @@ -38,6 +38,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="+", help="DVC-files to remove.", + metavar="targets", choices=completion.Required.DVC_FILE, ) remove_parser.set_defaults(func=CmdRemove) diff --git a/dvc/command/repro.py b/dvc/command/repro.py index 2de9dfdad8..e5c244aae3 100644 --- a/dvc/command/repro.py +++ b/dvc/command/repro.py @@ -72,6 +72,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="*", help=f"Stages to reproduce. '{PIPELINE_FILE}' by default.", + metavar="targets", choices=completion.Optional.DVC_FILE, ) repro_parser.add_argument( diff --git a/dvc/command/unprotect.py b/dvc/command/unprotect.py index eeb381d481..afbc19841c 100644 --- a/dvc/command/unprotect.py +++ b/dvc/command/unprotect.py @@ -36,6 +36,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="+", help="Data files/directories to unprotect.", + metavar="targets", choices=completion.Required.FILE, ) unprotect_parser.set_defaults(func=CmdUnprotect) diff --git a/dvc/command/update.py b/dvc/command/update.py index 7760e296c9..20f1b1fda0 100644 --- a/dvc/command/update.py +++ b/dvc/command/update.py @@ -36,6 +36,7 @@ def add_parser(subparsers, parent_parser): "targets", nargs="+", help="DVC-files to update.", + metavar="targets", choices=completion.Required.DVC_FILE, ) update_parser.add_argument( From a87746411c296527c7796dfe5f268cd667040c04 Mon Sep 17 00:00:00 2001 From: Casper da Costa-Luis Date: Sun, 21 Jun 2020 01:43:18 +0100 Subject: [PATCH 2/2] deps: update shtab version Part of #4070 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 06ae2da794..a2917e7ce6 100644 --- a/setup.py +++ b/setup.py @@ -78,7 +78,7 @@ def run(self): "tabulate>=0.8.7", "pygtrie==2.3.2", "dpath>=2.0.1,<3", - "shtab>=0.0.2", + "shtab>=1.0.2", ]