@variablelab/vland 0.3.6 → 0.3.7
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 +6 -4
- package/dist/cli.usage.kdl +2 -2
- package/dist/run.mjs +9 -4
- package/package.json +1 -1
- package/src/program/commands/completion.ts +13 -4
package/README.md
CHANGED
|
@@ -47,19 +47,21 @@ All templates target Node.js, use pnpm, and ship [`@rrlab/cli`](https://github.c
|
|
|
47
47
|
|
|
48
48
|
## Shell completion
|
|
49
49
|
|
|
50
|
-
`vland` ships a `completion` subcommand that prints a shell-specific script. Add
|
|
50
|
+
`vland` ships a `completion` subcommand that prints a shell-specific script. Add a guarded eval to your shell rc file:
|
|
51
51
|
|
|
52
52
|
```sh
|
|
53
53
|
# zsh — ~/.zshrc
|
|
54
|
-
eval "$(vland completion zsh)"
|
|
54
|
+
command -v vland >/dev/null 2>&1 && eval "$(vland completion zsh 2>/dev/null)"
|
|
55
55
|
|
|
56
56
|
# bash — ~/.bashrc
|
|
57
|
-
eval "$(vland completion bash)"
|
|
57
|
+
command -v vland >/dev/null 2>&1 && eval "$(vland completion bash 2>/dev/null)"
|
|
58
58
|
|
|
59
59
|
# fish — ~/.config/fish/config.fish
|
|
60
|
-
vland completion fish | source
|
|
60
|
+
command -v vland >/dev/null 2>&1; and vland completion fish 2>/dev/null | source
|
|
61
61
|
```
|
|
62
62
|
|
|
63
|
+
The `command -v` guard skips the line when no `vland` is on `PATH`. The `2>/dev/null` covers a mise shim with no active version: it passes the guard, then fails on stderr. If completion doesn't load, run `vland completion zsh` by hand to see why.
|
|
64
|
+
|
|
63
65
|
**Prerequisite:** the [`usage`](https://usage.jdx.dev) CLI must be on your `PATH` (it powers completion at runtime). Install via one of:
|
|
64
66
|
|
|
65
67
|
```sh
|
package/dist/cli.usage.kdl
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// @generated by @usage-spec/commander from Commander.js metadata
|
|
2
2
|
name vland
|
|
3
3
|
bin vland
|
|
4
|
-
version "0.3.
|
|
4
|
+
version "0.3.7"
|
|
5
5
|
usage "[options] [command]"
|
|
6
6
|
flag --usage help="print KDL spec for this CLI (https://kdl.dev)"
|
|
7
7
|
cmd completion help="print shell completion script (usage)" {
|
|
8
|
-
long_help "Prints a shell completion script for vland. Add
|
|
8
|
+
long_help "Prints a shell completion script for vland. Add your shell's line to its rc file:\n\n # bash — ~/.bashrc\n command -v vland >/dev/null 2>&1 && eval \"$(vland completion bash 2>/dev/null)\"\n\n # zsh — ~/.zshrc\n command -v vland >/dev/null 2>&1 && eval \"$(vland completion zsh 2>/dev/null)\"\n\n # fish — ~/.config/fish/config.fish\n command -v vland >/dev/null 2>&1; and vland completion fish 2>/dev/null | source"
|
|
9
9
|
arg <shell> help="target shell" {
|
|
10
10
|
choices bash zsh fish
|
|
11
11
|
}
|
package/dist/run.mjs
CHANGED
|
@@ -56,11 +56,16 @@ const SHELLS = [
|
|
|
56
56
|
"fish"
|
|
57
57
|
];
|
|
58
58
|
function createCompletionCommand() {
|
|
59
|
-
return createCommand("completion").summary(`print shell completion script (${TOOL_LABELS.USAGE})`).description(`Prints a shell completion script for vland. Add
|
|
59
|
+
return createCommand("completion").summary(`print shell completion script (${TOOL_LABELS.USAGE})`).description(`Prints a shell completion script for vland. Add your shell's line to its rc file:
|
|
60
60
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
# bash — ~/.bashrc
|
|
62
|
+
command -v vland >/dev/null 2>&1 && eval "$(vland completion bash 2>/dev/null)"
|
|
63
|
+
|
|
64
|
+
# zsh — ~/.zshrc
|
|
65
|
+
command -v vland >/dev/null 2>&1 && eval "$(vland completion zsh 2>/dev/null)"
|
|
66
|
+
|
|
67
|
+
# fish — ~/.config/fish/config.fish
|
|
68
|
+
command -v vland >/dev/null 2>&1; and vland completion fish 2>/dev/null | source`).configureHelp({ helpWidth: Number.POSITIVE_INFINITY }).addArgument(new Argument("<shell>", `target shell`).choices(SHELLS)).addHelpText("afterAll", `\nUnder the hood, this command uses ${TOOL_LABELS.USAGE} (https://usage.jdx.dev).
|
|
64
69
|
Make sure to have it installed and available in your PATH.`);
|
|
65
70
|
}
|
|
66
71
|
//#endregion
|
package/package.json
CHANGED
|
@@ -11,12 +11,21 @@ export function createCompletionCommand() {
|
|
|
11
11
|
return createCommand("completion")
|
|
12
12
|
.summary(`print shell completion script (${TOOL_LABELS.USAGE})`)
|
|
13
13
|
.description(
|
|
14
|
-
`Prints a shell completion script for vland. Add
|
|
14
|
+
`Prints a shell completion script for vland. Add your shell's line to its rc file:
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
# bash — ~/.bashrc
|
|
17
|
+
command -v vland >/dev/null 2>&1 && eval "$(vland completion bash 2>/dev/null)"
|
|
18
|
+
|
|
19
|
+
# zsh — ~/.zshrc
|
|
20
|
+
command -v vland >/dev/null 2>&1 && eval "$(vland completion zsh 2>/dev/null)"
|
|
21
|
+
|
|
22
|
+
# fish — ~/.config/fish/config.fish
|
|
23
|
+
command -v vland >/dev/null 2>&1; and vland completion fish 2>/dev/null | source`,
|
|
19
24
|
)
|
|
25
|
+
.configureHelp({
|
|
26
|
+
// Commander hard-wraps help at the terminal width; a wrapped rc line breaks when pasted.
|
|
27
|
+
helpWidth: Number.POSITIVE_INFINITY,
|
|
28
|
+
})
|
|
20
29
|
.addArgument(new Argument("<shell>", `target shell`).choices(SHELLS))
|
|
21
30
|
.addHelpText(
|
|
22
31
|
"afterAll",
|