yargs 18.0.0-candidate.1 → 18.0.0-candidate.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -13,9 +13,10 @@ _{{app_name}}_yargs_completions()
|
|
|
13
13
|
args=("\${COMP_WORDS[@]}")
|
|
14
14
|
|
|
15
15
|
# ask yargs to generate completions.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
COMPREPLY
|
|
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 }')
|
|
19
20
|
|
|
20
21
|
# if no match was found, fall back to filename completion
|
|
21
22
|
if [ \${#COMPREPLY[@]} -eq 0 ]; then
|