lib/completion-templates.ts

58 LOC · 58 covered · 0 uncovered · 1 ranges · 1119 concepts · 1 introducers · 788 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > export const completionShTemplate = `###-begin-{{app_name}}-completions-### yargs-factory.ts ×124
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 > # see https://stackoverflow.com/a/40944195/7080036 for the spaces-handling awk
17 > mapfile -t type_list < <({{app_path}} --get-yargs-completions "\${args[@]}")
18 > mapfile -t COMPREPLY < <(compgen -W "$( printf '%q ' "\${type_list[@]}" )" -- "\${cur_word}" |
19 > awk '/ / { print "\\""$0"\\"" } /^[^ ]+$/ { print $0 }')
20 >
21 > # if no match was found, fall back to filename completion
22 > if [ \${#COMPREPLY[@]} -eq 0 ]; then
23 > COMPREPLY=()
24 > fi
25 >
26 > return 0
27 > }
28 > complete -o bashdefault -o default -F _{{app_name}}_yargs_completions {{app_name}}
29 > ###-end-{{app_name}}-completions-###
30 > `;
31 >
32 > export const completionZshTemplate = `#compdef {{app_name}}
33 > ###-begin-{{app_name}}-completions-###
34 > #
35 > # yargs command completion script
36 > #
37 > # Installation: {{app_path}} {{completion_command}} >> ~/.zshrc
38 > # or {{app_path}} {{completion_command}} >> ~/.zprofile on OSX.
39 > #
40 > _{{app_name}}_yargs_completions()
41 > {
42 > local reply
43 > local si=$IFS
44 > IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
45 > IFS=$si
46 > if [[ \${#reply} -gt 0 ]]; then
47 > _describe 'values' reply
48 > else
49 > _default
50 > fi
51 > }
52 > if [[ "'\${zsh_eval_context[-1]}" == "loadautofunc" ]]; then
53 > _{{app_name}}_yargs_completions "$@"
54 > else
55 > compdef _{{app_name}}_yargs_completions {{app_name}}
56 > fi
57 > ###-end-{{app_name}}-completions-###
58 > `;