@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 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 it to your shell rc file:
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
@@ -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.6"
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 to your shell rc file:\n\n bash: eval \"$(vland completion bash)\"\n zsh: eval \"$(vland completion zsh)\"\n fish: vland completion fish | source"
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 to your shell rc file:
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
- bash: eval "$(vland completion bash)"
62
- zsh: eval "$(vland completion zsh)"
63
- fish: vland completion fish | source`).addArgument(new Argument("<shell>", `target shell`).choices(SHELLS)).addHelpText("afterAll", `\nUnder the hood, this command uses ${TOOL_LABELS.USAGE} (https://usage.jdx.dev).
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@variablelab/vland",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "The CLI to init a new project in Variable Land",
5
5
  "homepage": "https://github.com/withvariablelab/dx/tree/main/vland/cli#readme",
6
6
  "bugs": {
@@ -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 to your shell rc file:
14
+ `Prints a shell completion script for vland. Add your shell's line to its rc file:
15
15
 
16
- bash: eval "$(vland completion bash)"
17
- zsh: eval "$(vland completion zsh)"
18
- fish: vland completion fish | source`,
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",