GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(cli): stop echoing arguments in global-only hints · voidzero-dev/vite-plus@e7d57ad

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • Cargo.lock
  • crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_global_only_local/snapshots
    • global_only_commands_require_global_cli.md
  • packages/cli/binding
    • Cargo.toml
    • src/cli
      • help.rs
      • mod.rs
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎Cargo.lock‎

Copy file name to clipboardExpand all lines: Cargo.lock
-1Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Collapse file

‎crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_global_only_local/snapshots/global_only_commands_require_global_cli.md‎

Copy file name to clipboardExpand all lines: crates/vp_cli_snapshots/tests/cli_snapshots/fixtures/command_global_only_local/snapshots/global_only_commands_require_global_cli.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Install it with:
1313
curl -fsSL https://vite.plus | bash
1414
1515
Then open a new terminal and run the command again.
16-
If already installed, run `vp env current` directly in your terminal instead of through a package manager or package.json script.
16+
If it's already installed, run the command directly in your terminal instead of through a package manager or package.json script.
1717
1818
Installation Guide: https://viteplus.dev/guide/
1919
```
@@ -31,7 +31,7 @@ Install it with:
3131
curl -fsSL https://vite.plus | bash
3232
3333
Then open a new terminal and run the command again.
34-
If already installed, run `vp upgrade --check` directly in your terminal instead of through a package manager or package.json script.
34+
If it's already installed, run the command directly in your terminal instead of through a package manager or package.json script.
3535
3636
Installation Guide: https://viteplus.dev/guide/
3737
```
@@ -49,7 +49,7 @@ Install it with:
4949
curl -fsSL https://vite.plus | bash
5050
5151
Then open a new terminal and run the command again.
52-
If already installed, run `vp implode --yes` directly in your terminal instead of through a package manager or package.json script.
52+
If it's already installed, run the command directly in your terminal instead of through a package manager or package.json script.
5353
5454
Installation Guide: https://viteplus.dev/guide/
5555
```
Collapse file

‎packages/cli/binding/Cargo.toml‎

Copy file name to clipboardExpand all lines: packages/cli/binding/Cargo.toml
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ petgraph = { workspace = true }
2424
console = { workspace = true }
2525
serde = { workspace = true, features = ["derive"] }
2626
serde_json = { workspace = true }
27-
shell-escape = { workspace = true }
2827
tokio = { workspace = true, features = ["fs"] }
2928
tracing = { workspace = true }
3029
uuid = { workspace = true, features = ["v4"] }
Collapse file

‎packages/cli/binding/src/cli/help.rs‎

Copy file name to clipboardExpand all lines: packages/cli/binding/src/cli/help.rs
+4-15Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@ use super::types::SynthesizableSubcommand;
1717
/// needs the names to point users at the global installation.
1818
const GLOBAL_ONLY_SUBCOMMANDS: &[&str] = &["env", "upgrade", "implode"];
1919

20-
pub(super) fn handle_cli_parse_error(
21-
err: clap::Error,
22-
args: &[String],
23-
) -> Result<ExitStatus, Error> {
24-
if matches!(err.kind(), ErrorKind::InvalidSubcommand)
25-
&& print_invalid_subcommand_error(&err, args)
26-
{
20+
pub(super) fn handle_cli_parse_error(err: clap::Error) -> Result<ExitStatus, Error> {
21+
if matches!(err.kind(), ErrorKind::InvalidSubcommand) && print_invalid_subcommand_error(&err) {
2722
return Ok(ExitStatus(err.exit_code() as u8));
2823
}
2924
if matches!(err.kind(), ErrorKind::UnknownArgument)
@@ -112,7 +107,7 @@ pub(super) fn should_print_help(args: &[String]) -> bool {
112107
args.is_empty() || matches!(args, [arg] if arg == "-h" || arg == "--help")
113108
}
114109

115-
fn print_invalid_subcommand_error(error: &clap::Error, args: &[String]) -> bool {
110+
fn print_invalid_subcommand_error(error: &clap::Error) -> bool {
116111
let Some(details) = extract_invalid_subcommand_details(error) else {
117112
return false;
118113
};
@@ -127,17 +122,11 @@ fn print_invalid_subcommand_error(error: &clap::Error, args: &[String]) -> bool
127122
"curl -fsSL https://vite.plus | bash"
128123
};
129124
let install_command = style(install_command).for_stderr().blue().bright();
130-
// Echo every argument so following the hint repeats the original
131-
// request, e.g. `vp upgrade --check` must not become `vp upgrade`.
132-
let original_command = std::iter::once("vp".into())
133-
.chain(args.iter().map(|arg| shell_escape::escape(arg.as_str().into())))
134-
.collect::<Vec<_>>()
135-
.join(" ");
136125
output::error(&format!(
137126
"The {command} command is only available in the global `vp` CLI.\n\n\
138127
{}\n {install_command}\n\n\
139128
Then open a new terminal and run the command again.\n\
140-
If already installed, run `{original_command}` {} instead of through a package manager or package.json script.\n\n\
129+
If it's already installed, run the command {} instead of through a package manager or package.json script.\n\n\
141130
{} {}",
142131
style("Install it with:").for_stderr().bold(),
143132
style("directly in your terminal").for_stderr().bold(),
Collapse file

‎packages/cli/binding/src/cli/mod.rs‎

Copy file name to clipboardExpand all lines: packages/cli/binding/src/cli/mod.rs
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ pub async fn main(
402402
let args_with_program = std::iter::once("vp".to_string()).chain(args_vec.iter().cloned());
403403
let cli_args = match CLIArgs::try_parse_from(args_with_program) {
404404
Ok(args) => args,
405-
Err(err) => return handle_cli_parse_error(err, &args_vec),
405+
Err(err) => return handle_cli_parse_error(err),
406406
};
407407

408408
match cli_args {

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.