source: trip-planner-front/node_modules/yargs/build/lib/completion-templates.js@ ceaed42

Last change on this file since ceaed42 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

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