Skip to content

Commit 9ec78a2

Browse files
Boshenclaude
andcommitted
docs(global_cli): trim vp env examples and move to long-help
Switch from `after_help` to `after_long_help` so `-h` stays compact and examples only render with `--help`. Also trim each block to the non-obvious cases (drop examples already implied by the arg doc). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 43809d4 commit 9ec78a2

2 files changed

Lines changed: 13 additions & 21 deletions

File tree

  • crates/vite_global_cli/src
  • packages/cli/snap-tests-global/command-env-use

crates/vite_global_cli/src/cli.rs

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,10 @@ pub enum EnvSubcommands {
298298
Print,
299299

300300
/// Set or show the global default Node.js version
301-
#[command(after_help = "\
301+
#[command(after_long_help = "\
302302
Examples:
303-
vp env default # Show the current default
304-
vp env default lts # Set the default to latest LTS
305-
vp env default 20.18.0 # Set a specific version")]
303+
vp env default # Show the current default
304+
vp env default lts # Set the default")]
306305
Default {
307306
/// Version to set as default (e.g., "20.18.0", "lts", "latest").
308307
/// If omitted, prints the current default.
@@ -335,13 +334,11 @@ Examples:
335334
},
336335

337336
/// Pin a Node.js version in the current directory (creates .node-version)
338-
#[command(after_help = "\
337+
#[command(after_long_help = "\
339338
Examples:
340-
vp env pin # Show the currently pinned version
341-
vp env pin lts # Pin to latest LTS
342-
vp env pin 20.18.0 # Pin a specific version
343-
vp env pin \"^20.0.0\" --force # Pin a range, overwriting existing file
344-
vp env pin --unpin # Remove .node-version")]
339+
vp env pin lts # Pin to latest LTS
340+
vp env pin --unpin # Remove .node-version
341+
vp env pin \"^20.0.0\" --force # Overwrite existing pin")]
345342
Pin {
346343
/// Version to pin (e.g., "20.18.0", "lts", "latest", "^20.0.0").
347344
/// If omitted, prints the currently pinned version.
@@ -397,11 +394,10 @@ Examples:
397394
/// Execute a command with a specific Node.js version
398395
#[command(
399396
visible_alias = "run",
400-
after_help = "\
397+
after_long_help = "\
401398
Examples:
402-
vp env exec --node lts npm install # Run npm install with latest LTS
403-
vp env exec --node 20.18.0 node script.js # Run with a specific version
404-
vp env exec node -v # Shim mode: version auto-resolved"
399+
vp env exec --node lts npm install # Pin version for this invocation
400+
vp env exec node -v # Shim mode: version auto-resolved"
405401
)]
406402
Exec {
407403
/// Node.js version to use (e.g., "20.18.0", "lts", "^20.0.0").
@@ -436,11 +432,9 @@ Examples:
436432
},
437433

438434
/// Use a specific Node.js version for this shell session
439-
#[command(after_help = "\
435+
#[command(after_long_help = "\
440436
Examples:
441-
vp env use # Use the version from .node-version / package.json
442-
vp env use 20 # Override the session with Node 20
443-
vp env use lts # Use latest LTS for this session
437+
vp env use lts # Override session with latest LTS
444438
vp env use --unset # Clear the session override")]
445439
Use {
446440
/// Version to use (e.g., "20", "20.18.0", "lts", "latest").

packages/cli/snap-tests-global/command-env-use/snap.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ Options:
1313
-h, --help Print help
1414

1515
Examples:
16-
vp env use # Use the version from .node-version / package.json
17-
vp env use 20 # Override the session with Node 20
18-
vp env use lts # Use latest LTS for this session
16+
vp env use lts # Override session with latest LTS
1917
vp env use --unset # Clear the session override
2018

2119
Documentation: https://viteplus.dev/guide/env

0 commit comments

Comments
 (0)