Skip to content

Commit

Permalink
scripts: update import->import-url and add get-url to shell aut…
Browse files Browse the repository at this point in the history
…ocomplete
  • Loading branch information
jorgeorpinel committed Jun 27, 2019
1 parent 8c2fa8d commit fd12a0e
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 32 deletions.
8 changes: 4 additions & 4 deletions scripts/completion/dvc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
# - https://opensource.com/article/18/3/creating-bash-completion-script
#----------------------------------------------------------

_dvc_commands='init destroy add import checkout run pull push fetch \
status repro remove move unprotect gc config remote metrics \
install root lock unlock pipeline commit'
_dvc_commands='add checkout commit config destroy fetch get-url gc \
import-url init install lock metrics move pipeline pull push \
remote remove repro root run status unlock unprotect'

_dvc_options="-h --help -v --version"
_dvc_global_options="-h --help -q --quiet -V --verbose"
Expand All @@ -21,7 +21,7 @@ _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_gc="-a --all-branches -T --all-tags -c --cloud -r --remote -f --force -p --project"
_dvc_import="--resume"
_dvc_import-url="--resume-f --file"
_dvc_init="--no-scm -f --force"
_dvc_install=""
_dvc_lock="$(compgen -G '*.dvc')"
Expand Down
63 changes: 35 additions & 28 deletions scripts/completion/dvc.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ _dvc_commands() {
"destroy:Remove DVC-files, local DVC config and data cache."
"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."
"gc:Collect unused data from DVC cache or a remote storage."
"import:Download or copy files from URL and take under DVC control."
"import-url:Download or copy file from URL 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."
Expand Down Expand Up @@ -106,6 +107,11 @@ _dvc_fetch=(
"*:Stages:_files -g '(*.dvc|Dvcfile)'"
)

_dvc_geturl=(
"1:URL:"
"2:Output:"
)

_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.]"
Expand All @@ -116,7 +122,7 @@ _dvc_gc=(
{-p,--projects}"[Keep data files required by these projects in addition to the current one.]:Repos:_files"
)

_dvc_import=(
_dvc_importurl=(
"--resume[Resume previously started download.]"
{-f,--file}"[Specify name of the DVC-file it generates.]:File:_files"
"1:URL:"
Expand Down Expand Up @@ -248,30 +254,31 @@ _arguments \
'*::args:->args'

case $words[1] in
add) _arguments $_dvc_global_options $_dvc_add ;;
cache) _arguments $_dvc_global_options $_dvc_cache ;;
checkout) _arguments $_dvc_global_options $_dvc_checkout ;;
commit) _arguments $_dvc_global_options $_dvc_commit ;;
config) _arguments $_dvc_global_options $_dvc_config ;;
destroy) _arguments $_dvc_global_options $_dvc_destroy ;;
diff) _arguments $_dvc_global_options $_dvc_diff ;;
fetch) _arguments $_dvc_global_options $_dvc_fetch ;;
gc) _arguments $_dvc_global_options $_dvc_gc ;;
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 ;;
metrics) _arguments $_dvc_global_options $_dvc_metrics ;;
move) _arguments $_dvc_global_options $_dvc_move ;;
pipeline) _arguments $_dvc_global_options $_dvc_pipeline ;;
pull) _arguments $_dvc_global_options $_dvc_pull ;;
push) _arguments $_dvc_global_options $_dvc_push ;;
remote) _arguments $_dvc_global_options $_dvc_remote ;;
remove) _arguments $_dvc_global_options $_dvc_remove ;;
repro) _arguments $_dvc_global_options $_dvc_repro ;;
root) _arguments $_dvc_global_options $_dvc_root ;;
run) _arguments $_dvc_global_options $_dvc_run ;;
status) _arguments $_dvc_global_options $_dvc_status ;;
unlock) _arguments $_dvc_global_options $_dvc_unlock ;;
unprotect) _arguments $_dvc_global_options $_dvc_unprotect ;;
add) _arguments $_dvc_global_options $_dvc_add ;;
cache) _arguments $_dvc_global_options $_dvc_cache ;;
checkout) _arguments $_dvc_global_options $_dvc_checkout ;;
commit) _arguments $_dvc_global_options $_dvc_commit ;;
config) _arguments $_dvc_global_options $_dvc_config ;;
destroy) _arguments $_dvc_global_options $_dvc_destroy ;;
diff) _arguments $_dvc_global_options $_dvc_diff ;;
fetch) _arguments $_dvc_global_options $_dvc_fetch ;;
get-url) _arguments $_dvc_global_options $_dvc_geturl ;;
gc) _arguments $_dvc_global_options $_dvc_gc ;;
import-url) _arguments $_dvc_global_options $_dvc_importurl ;;
init) _arguments $_dvc_global_options $_dvc_init ;;
install) _arguments $_dvc_global_options $_dvc_install ;;
lock) _arguments $_dvc_global_options $_dvc_lock ;;
metrics) _arguments $_dvc_global_options $_dvc_metrics ;;
move) _arguments $_dvc_global_options $_dvc_move ;;
pipeline) _arguments $_dvc_global_options $_dvc_pipeline ;;
pull) _arguments $_dvc_global_options $_dvc_pull ;;
push) _arguments $_dvc_global_options $_dvc_push ;;
remote) _arguments $_dvc_global_options $_dvc_remote ;;
remove) _arguments $_dvc_global_options $_dvc_remove ;;
repro) _arguments $_dvc_global_options $_dvc_repro ;;
root) _arguments $_dvc_global_options $_dvc_root ;;
run) _arguments $_dvc_global_options $_dvc_run ;;
status) _arguments $_dvc_global_options $_dvc_status ;;
unlock) _arguments $_dvc_global_options $_dvc_unlock ;;
unprotect) _arguments $_dvc_global_options $_dvc_unprotect ;;
esac

0 comments on commit fd12a0e

Please sign in to comment.