If the user calls dvc push --unknown-option
, it would be great if the displayed help text was about the options for push
. Currently here's what happens:
% dvc push --dry-run
ERROR: unrecognized arguments: --dry-run
Having any troubles?. Hit us up at https://dvc.org/support, we are always happy to help!
usage: dvc [-h] [-q | -v] [-V] COMMAND ...
Data Version Control
optional arguments:
-h, --help show this help message and exit
-q, --quiet Be quiet.
-v, --verbose Be verbose.
-V, --version Show program's version.
Available Commands:
COMMAND Use dvc COMMAND --help for command-specific help.
init Initialize DVC in the current directory.
get Download data from DVC repository.
get-url Download or copy files from URL.
destroy Remove DVC-files, local DVC config and data cache.
add Take data files or directories under DVC control.
remove Remove DVC-file outputs.
move Rename or move a DVC controlled data file or a directory.
unprotect Unprotect data files or directories.
run Generate a stage file from a command and execute the command.
repro Check for changes and reproduce stages and dependencies.
pull Pull data files from a DVC remote storage.
push Push data files to a DVC remote storage.
fetch Fetch data files from a DVC remote storage.
status Show changed stages, compare local cache and a remote storage.
gc Collect unused data from DVC cache or a remote storage.
import Download data from DVC repository and take it under DVC control.
import-url Download or copy file from URL and take it under DVC control.
config Get or set config options.
checkout Checkout data files from cache.
remote Manage remote storage configuration.
cache Manage cache settings.
metrics Commands to add, manage, collect and display metrics.
install Install DVC git hooks into the repository.
root Relative path to the repository's directory.
lock Lock DVC-files.
unlock Unlock DVC-files.
pipeline Manage pipelines.
commit Save changed data to cache and update DVC-files.
diff Show a diff of a DVC controlled data file or a directory.
version Show DVC version and system/environment informaion.
update Update data artifacts imported from other DVC repositories.
This may not be easy to achieve with argparse
, not sure.
For the record, this might be a way to workaround this https://stackoverflow.com/questions/25333847/argparse-subcommand-error-message .
I'm not sure whether Python's parsers have this concept, but in something Perl's regexes (search for "COMMIT") there's the ability to "commit" to a certain arm of the parse tree, meaning that if the parse fails beyond that point, it won't backtrack upward beyond it.
In other words: once "push" is seen as a word, commit to parsing the whole command as a "push" subcommand.
If it has/had that ability, it would make it pretty easy to generate the right error.
maybe also want to consider https://github.com/docopt/docopt#subparsers-multi-level-help-and-huge-applications-like-git
I think this might be a duplicate of #1924 (zsh
) and #1923 (bash
)
@casperdcl This issue is not related to completion scripts.
Right just re-read the description
Most helpful comment
Right just re-read the description