Skip to content

Commit

Permalink
diff: autocompletion script for params, and show-md (#3786)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored May 12, 2020
1 parent 451c7aa commit cc16b28
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/completion/dvc.bash
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# - https://stackoverflow.com/questions/12933362

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

_dvc_options='-h --help -V --version'
Expand All @@ -21,7 +21,7 @@ _dvc_commit='-f --force -d --with-deps -R --recursive'
_dvc_commit_COMPGEN=_dvc_compgen_DVCFiles
_dvc_config='-u --unset --local --system --global'
_dvc_destroy='-f --force'
_dvc_diff='-t --show-json --show-hash'
_dvc_diff='-t --show-json --show-hash --show-md'
_dvc_fetch='-j --jobs -r --remote -a --all-branches -T --all-tags -d --with-deps -R --recursive'
_dvc_fetch_COMPGEN=_dvc_compgen_DVCFiles
_dvc_gc='-a --all-branches --all-commits -T --all-tags -w --workspace -c --cloud -r --remote -f --force -p --projects -j --jobs'
Expand All @@ -38,7 +38,7 @@ _dvc_lock_COMPGEN=_dvc_compgen_DVCFiles
_dvc_metrics='add diff modify remove show'
_dvc_metrics_add='-t --type -x --xpath'
_dvc_metrics_add_COMPGEN=_dvc_compgen_files
_dvc_metrics_diff='--targets -t --type -x --xpath -R --show-json'
_dvc_metrics_diff='--targets -t --type -x --xpath -R --show-json --show-md'
_dvc_metrics_modify='-t --type -x --xpath'
_dvc_metrics_modify_COMPGEN=_dvc_compgen_files
_dvc_metrics_remove=''
Expand All @@ -47,6 +47,8 @@ _dvc_metrics_show='-t --type -x --xpath -a --all-branches -T --all-tags -R --rec
_dvc_metrics_show_COMPGEN=_dvc_compgen_files
_dvc_move=''
_dvc_move_COMPGEN=_dvc_compgen_files
_dvc_params='diff'
_dvc_params_diff='--all --show-json --show-md'
_dvc_pipeline='list show'
_dvc_pipeline_list=''
_dvc_pipeline_show='-c --commands -o --outs --ascii --dot --tree -l --locked'
Expand Down
7 changes: 7 additions & 0 deletions scripts/completion/dvc.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ _dvc_commands() {
"lock:Lock DVC-file."
"metrics:Commands to add, manage, collect and display metrics."
"move:Rename or move a DVC controlled data file or a directory."
"params:Commands to display params."
"pipeline:Manage pipelines."
"pull:Pull data files from a DVC remote storage."
"push:Push data files to a DVC remote storage."
Expand Down Expand Up @@ -102,6 +103,7 @@ _dvc_destroy=(
_dvc_diff=(
"--show-json[Format the output into a JSON]"
"--show-hash[Display hash value for each entry]"
"--show-md[Format the output into a Markdown table]"
"1:Old Git commit to compare (defaults to HEAD):"
"2:New Git commit to compare (defaults to the current workspace):"
)
Expand Down Expand Up @@ -182,6 +184,10 @@ _dvc_move=(
"2:Destination:"
)

_dvc_params=(
"1:Sub command:(diff)"
)

_dvc_pipeline=(
"1:Sub command:(show list)"
)
Expand Down Expand Up @@ -312,6 +318,7 @@ case $words[1] in
list) _arguments $_dvc_global_options $_dvc_list ;;
metrics) _arguments $_dvc_global_options $_dvc_metrics ;;
move) _arguments $_dvc_global_options $_dvc_move ;;
params) _arguments $_dvc_global_options $_dvc_params ;;
pipeline) _arguments $_dvc_global_options $_dvc_pipeline ;;
pull) _arguments $_dvc_global_options $_dvc_pull ;;
push) _arguments $_dvc_global_options $_dvc_push ;;
Expand Down

0 comments on commit cc16b28

Please sign in to comment.