completion.sh.hbs 594 B

12345678910111213141516171819202122
  1. ###-begin-{{app_name}}-completions-###
  2. #
  3. # yargs command completion script
  4. #
  5. # Installation: {{app_path}} completion >> ~/.bashrc
  6. # or {{app_path}} completion >> ~/.bash_profile on OSX.
  7. #
  8. _yargs_completions()
  9. {
  10. local cur_word args type_list
  11. cur_word="${COMP_WORDS[COMP_CWORD]}"
  12. args=$(printf "%s " "${COMP_WORDS[@]}")
  13. # ask yargs to generate completions.
  14. type_list=`{{app_path}} --get-yargs-completions $args`
  15. COMPREPLY=( $(compgen -W "${type_list}" -- ${cur_word}) )
  16. return 0
  17. }
  18. complete -F _yargs_completions {{app_name}}
  19. ###-end-{{app_name}}-completions-###