Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

completion-templates.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. exports.completionShTemplate =
  2. `###-begin-{{app_name}}-completions-###
  3. #
  4. # yargs command completion script
  5. #
  6. # Installation: {{app_path}} {{completion_command}} >> ~/.bashrc
  7. # or {{app_path}} {{completion_command}} >> ~/.bash_profile on OSX.
  8. #
  9. _yargs_completions()
  10. {
  11. local cur_word args type_list
  12. cur_word="\${COMP_WORDS[COMP_CWORD]}"
  13. args=("\${COMP_WORDS[@]}")
  14. # ask yargs to generate completions.
  15. type_list=$({{app_path}} --get-yargs-completions "\${args[@]}")
  16. COMPREPLY=( $(compgen -W "\${type_list}" -- \${cur_word}) )
  17. # if no match was found, fall back to filename completion
  18. if [ \${#COMPREPLY[@]} -eq 0 ]; then
  19. COMPREPLY=()
  20. fi
  21. return 0
  22. }
  23. complete -o default -F _yargs_completions {{app_name}}
  24. ###-end-{{app_name}}-completions-###
  25. `
  26. exports.completionZshTemplate = `###-begin-{{app_name}}-completions-###
  27. #
  28. # yargs command completion script
  29. #
  30. # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
  31. # or {{app_path}} {{completion_command}} >> ~/.zsh_profile on OSX.
  32. #
  33. _{{app_name}}_yargs_completions()
  34. {
  35. local reply
  36. local si=$IFS
  37. IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
  38. IFS=$si
  39. _describe 'values' reply
  40. }
  41. compdef _{{app_name}}_yargs_completions {{app_name}}
  42. ###-end-{{app_name}}-completions-###
  43. `