1 exports.completionShTemplate =
2 `###-begin-{{app_name}}-completions-###
4 # yargs command completion script
6 # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
7 # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
11 local cur_word args type_list
13 cur_word="\${COMP_WORDS[COMP_CWORD]}"
14 args=("\${COMP_WORDS[@]}")
16 # ask yargs to generate completions.
17 type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
19 COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
21 # if no match was found, fall back to filename completion
22 if [ \${#COMPREPLY[@]} -eq 0 ]; then
28 complete -o default -F _yargs_completions {{app_name}}
29 ###-end-{{app_name}}-completions-###
32 exports.completionZshTemplate = `###-begin-{{app_name}}-completions-###
34 # yargs command completion script
36 # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
37 # or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
39 _{{app_name}}_yargs_completions()
43 IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
45 _describe 'values' reply
47 compdef _{{app_name}}_yargs_completions {{app_name}}
48 ###-end-{{app_name}}-completions-###