-
Notifications
You must be signed in to change notification settings - Fork 1
Shell completions for ddf command
Semio Zheng edited this page Mar 22, 2017
·
5 revisions
We need to enable completion in Zsh if it's not done yet. For example if we are going to put the completion file in ~/.zsh-completions
, we should add following lines to ~/.zshrc
:
# folder of autocomplete functions
fpath=($HOME/.zsh-completions $fpath)
# enable autocomplete function
autoload -U compinit
compinit
Then create a file ~/.zsh-completions/_ddf
, append following lines:
#compdef ddf
_ddf() {
local -a commands
commands=(
'build_recipe:create a complete recipe by expanding all includes in the input recipe.'
'cleanup:clean up ddf files or translation files.'
'create_datapackage:create datapackage.json'
'merge_translation:merge all translation files from crowdin'
'new:create a new ddf project'
'run_recipe:generate new ddf dataset with recipe'
'split_translation:split ddf files for crowdin translation.'
'validate_recipe:validate the recipe'
)
if (( CURRENT == 2 )); then
_describe -t commands 'commands' commands
else
_path_files
fi
return 0
}
_ddf
reload the shell and the completion should work.
TODO
TODO