Skip to content

Commit ba04257

Browse files
committed
fix: rename CLI program name from vite to vp in help output
Change the program name passed to clap so `Usage:` lines show `vp run` instead of `vite run`.
1 parent db6db6d commit ba04257

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

packages/cli/binding/src/cli.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ pub enum SynthesizableSubcommand {
103103

104104
/// Top-level CLI argument parser for vite-plus.
105105
#[derive(Debug, Parser)]
106-
#[command(name = "vite", disable_help_subcommand = true)]
106+
#[command(name = "vp", disable_help_subcommand = true)]
107107
enum CLIArgs {
108108
/// vite-task commands (run, cache)
109109
#[command(flatten)]
@@ -579,10 +579,10 @@ impl CommandHandler for VitePlusCommandHandler {
579579
if program != "vp" && program != "vite" {
580580
return Ok(HandledCommand::Verbatim);
581581
}
582-
// Parse "vp <args>" using CLIArgs
583-
let cli_args = CLIArgs::try_parse_from(
584-
iter::once(command.program.as_str()).chain(command.args.iter().map(Str::as_str)),
585-
)?;
582+
// Parse "vp <args>" using CLIArgs — always use "vp" as the program name
583+
// so clap shows "Usage: vp ..." even if the original command was "vite ..."
584+
let cli_args =
585+
CLIArgs::try_parse_from(iter::once("vp").chain(command.args.iter().map(Str::as_str)))?;
586586
match cli_args {
587587
CLIArgs::Synthesizable(subcmd) => {
588588
let resolved = self.resolver.resolve(subcmd, &command.envs, &command.cwd).await?;
@@ -814,7 +814,7 @@ pub async fn main(
814814
return Ok(ExitStatus::SUCCESS);
815815
}
816816

817-
let args_with_program = std::iter::once("vite".to_string()).chain(args_vec.iter().cloned());
817+
let args_with_program = std::iter::once("vp".to_string()).chain(args_vec.iter().cloned());
818818
let cli_args = match CLIArgs::try_parse_from(args_with_program) {
819819
Ok(args) => args,
820820
Err(err) => {

packages/cli/snap-tests/command-vp-alias/snap.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Options:
2323
> vp run -h # vp run should show help
2424
Run tasks
2525

26-
Usage: vite run [OPTIONS] <TASK_SPECIFIER> [ADDITIONAL_ARGS]...
26+
Usage: vp run [OPTIONS] <TASK_SPECIFIER> [ADDITIONAL_ARGS]...
2727

2828
Arguments:
2929
<TASK_SPECIFIER> `packageName#taskName` or `taskName`

0 commit comments

Comments
 (0)