From e04e4c037c4530c31890270bd748c880bd676c66 Mon Sep 17 00:00:00 2001 From: Jorge Orpinel Date: Thu, 27 Jun 2019 18:37:09 -0500 Subject: [PATCH] scripts: add import and get commands (et al) to autocompletes Related to https://github.com/iterative/dvc.org/issues/385 This may close #2069 --- scripts/completion/dvc.bash | 11 ++++++++--- scripts/completion/dvc.zsh | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/scripts/completion/dvc.bash b/scripts/completion/dvc.bash index 21d7cdf6c..d620a2738 100644 --- a/scripts/completion/dvc.bash +++ b/scripts/completion/dvc.bash @@ -8,8 +8,8 @@ # - https://opensource.com/article/18/3/creating-bash-completion-script #---------------------------------------------------------- -_dvc_commands='add checkout commit config destroy fetch get-url gc \ - import-url init install lock metrics move pipeline pull push \ +_dvc_commands='add checkout commit config destroy fetch get-url get gc \ + import-url import init install lock metrics move pipeline pull push \ remote remove repro root run status unlock unprotect' _dvc_options="-h --help -v --version" @@ -17,11 +17,15 @@ _dvc_global_options="-h --help -q --quiet -V --verbose" _dvc_add="-R --recursive -f --file --no-commit" _dvc_checkout="$(compgen -G '*.dvc')" +_dvc_commit="" _dvc_config="-u --unset --local --system --global" _dvc_destroy="-f --force" _dvc_fetch="--show-checksums -j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive" +_dvc_get-url="" +_dvc_get="-o --out --rev" _dvc_gc="-a --all-branches -T --all-tags -c --cloud -r --remote -f --force -p --project" -_dvc_import-url="--resume-f --file" +_dvc_import-url="--resume -f --file" +_dvc_import="-o --out --rev" _dvc_init="--no-scm -f --force" _dvc_install="" _dvc_lock="$(compgen -G '*.dvc')" @@ -37,6 +41,7 @@ _dvc_root="" _dvc_run="--no-exec -f --file -c --cwd -d --deps -o --outs -O --outs-no-cache -M --metrics-no-cache -y --yes --overwrite-dvc-file --ignore-build-cache --remove-outs --no-commit -w --wdir" _dvc_status="--show-checksums -j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -c --cloud -q --quiet" _dvc_unlock="$(compgen -G '*.dvc')" +_dvc_unprotect="" # Notes: # diff --git a/scripts/completion/dvc.zsh b/scripts/completion/dvc.zsh index 6a81d2a95..7a0dc702b 100644 --- a/scripts/completion/dvc.zsh +++ b/scripts/completion/dvc.zsh @@ -21,8 +21,10 @@ _dvc_commands() { "diff:Show a diff of a DVC controlled data file or a directory." "fetch:Fetch data files from a DVC remote storage." "get-url:Download or copy files from URL." + "get:Download data from DVC repository." "gc:Collect unused data from DVC cache or a remote storage." "import-url:Download or copy file from URL and take it under DVC control." + "import:Download data from DVC repository and take it under DVC control." "init:Initialize DVC in the current directory." "install:Install DVC git hooks into the repository." "lock:Lock DVC-file." @@ -112,6 +114,13 @@ _dvc_geturl=( "2:Output:" ) +_dvc_get=( + {-o,--out}"[Destination path to put data to.]:OUT:_files -/" + "--rev[DVC repository git revision.]:Commit hash:" + "1:URL:" + "2:Path:" +) + _dvc_gc=( {-a,--all-branches}"[Keep data files for the tips of all git branches.]" {-T,--all-tags}"[Keep data files for all git tags.]" @@ -129,6 +138,13 @@ _dvc_importurl=( "2:Output:" ) +_dvc_import=( + {-o,--out}"[Destination path to put data to.]:OUT:_files -/" + "--rev[DVC repository git revision.]:Commit hash:" + "1:URL:" + "2:Path:" +) + _dvc_init=( "--no-scm[Initiate dvc in directory that is not tracked by any scm tool.]" {-f,--force}"[Overwrite existing '.dvc' directory. This operation removes local cache.]" @@ -263,8 +279,10 @@ case $words[1] in diff) _arguments $_dvc_global_options $_dvc_diff ;; fetch) _arguments $_dvc_global_options $_dvc_fetch ;; get-url) _arguments $_dvc_global_options $_dvc_geturl ;; + get) _arguments $_dvc_global_options $_dvc_get ;; gc) _arguments $_dvc_global_options $_dvc_gc ;; import-url) _arguments $_dvc_global_options $_dvc_importurl ;; + import) _arguments $_dvc_global_options $_dvc_import ;; init) _arguments $_dvc_global_options $_dvc_init ;; install) _arguments $_dvc_global_options $_dvc_install ;; lock) _arguments $_dvc_global_options $_dvc_lock ;;