yargs 18.0.0-candidate.3 → 18.0.0-candidate.5
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.
- package/README.md +2 -2
- package/build/lib/completion-templates.js +10 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -38,7 +38,7 @@ Rules & Behavior
|
|
|
38
38
|
return a Promise [boolean]
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
*
|
|
41
|
+
* generate completion scripts for Bash and Zsh for your command
|
|
42
42
|
* and [tons more](/docs/api.md).
|
|
43
43
|
|
|
44
44
|
## Installation
|
|
@@ -78,7 +78,7 @@ $ ./plunder.js --ships 12 --distance 98.7
|
|
|
78
78
|
Retreat from the xupptumblers!
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
> Note: `hideBin` is a shorthand for
|
|
81
|
+
> Note: `hideBin` is a shorthand for `process.argv.slice(2)`. It has the benefit that it takes into account variations in some environments, e.g., [Electron](https://github.com/electron/electron/issues/4690).
|
|
82
82
|
|
|
83
83
|
### Complex Example
|
|
84
84
|
|
|
@@ -42,8 +42,16 @@ _{{app_name}}_yargs_completions()
|
|
|
42
42
|
local si=$IFS
|
|
43
43
|
IFS=$'\n' reply=($(COMP_CWORD="$((CURRENT-1))" COMP_LINE="$BUFFER" COMP_POINT="$CURSOR" {{app_path}} --get-yargs-completions "\${words[@]}"))
|
|
44
44
|
IFS=$si
|
|
45
|
-
|
|
45
|
+
if [[ \${#reply} -gt 0 ]]; then
|
|
46
|
+
_describe 'values' reply
|
|
47
|
+
else
|
|
48
|
+
_default
|
|
49
|
+
fi
|
|
46
50
|
}
|
|
47
|
-
|
|
51
|
+
if [[ "'\${zsh_eval_context[-1]}" == "loadautofunc" ]]; then
|
|
52
|
+
_{{app_name}}_yargs_completions "$@"
|
|
53
|
+
else
|
|
54
|
+
compdef _{{app_name}}_yargs_completions {{app_name}}
|
|
55
|
+
fi
|
|
48
56
|
###-end-{{app_name}}-completions-###
|
|
49
57
|
`;
|