1 ###-begin-{{app_name}}-completions-###
3 # yargs command completion script
5 # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
6 # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
10 local cur_word args type_list
12 cur_word="${COMP_WORDS[COMP_CWORD]}"
13 args=("${COMP_WORDS[@]}")
15 # ask yargs to generate completions.
16 type_list=$({{app_path}} --get-yargs-completions "${args[@]}")
18 COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )
20 # if no match was found, fall back to filename completion
21 if [ ${#COMPREPLY[@]} -eq 0 ]; then
22 COMPREPLY=( $(compgen -f -- "${cur_word}" ) )
27 complete -F _yargs_completions {{app_name}}
28 ###-end-{{app_name}}-completions-###