diff --git a/crates/vite_pm_cli/src/cli.rs b/crates/vite_pm_cli/src/cli.rs index 2e2c94ee86..872fe726d7 100644 --- a/crates/vite_pm_cli/src/cli.rs +++ b/crates/vite_pm_cli/src/cli.rs @@ -781,7 +781,7 @@ pub enum PmCommands { subcommand: String, /// Additional arguments - #[arg(last = true, allow_hyphen_values = true)] + #[arg(allow_hyphen_values = true, trailing_var_arg = true)] pass_through_args: Option>, }, @@ -1416,6 +1416,17 @@ mod tests { assert_eq!(pass_through_args, Some(vec!["--workspace-root".to_string()])); } + #[test] + fn cache_clean_accepts_flags_without_separator() { + let command = parse_pm_command(&["vp", "pm", "cache", "clean", "--force"]) + .expect("cache pass-through flags should parse"); + + let PackageManagerCommand::Pm(PmCommands::Cache { pass_through_args, .. }) = command else { + panic!("expected Cache variant"); + }; + assert_eq!(pass_through_args, Some(vec!["--force".to_string()])); + } + #[test] fn stage_publish_parses() { let command = parse_pm_command(&["vp", "pm", "stage", "publish", "--tag", "next"]) diff --git a/packages/cli/snap-tests-global/command-cache-bun/snap.txt b/packages/cli/snap-tests-global/command-cache-bun/snap.txt index 6c74bd2757..c32141ba6c 100644 --- a/packages/cli/snap-tests-global/command-cache-bun/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-bun/snap.txt @@ -1,5 +1,5 @@ > vp pm cache --help # should show help -Usage: vp pm cache [-- ...] +Usage: vp pm cache [PASS_THROUGH_ARGS]... Manage package cache diff --git a/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt b/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt index 046e134dbe..2bddb46168 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-pnpm10/snap.txt @@ -1,5 +1,5 @@ > vp pm cache --help # should show help -Usage: vp pm cache [-- ...] +Usage: vp pm cache [PASS_THROUGH_ARGS]... Manage package cache diff --git a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt index 046e134dbe..2bddb46168 100644 --- a/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt +++ b/packages/cli/snap-tests-global/command-cache-pnpm11/snap.txt @@ -1,5 +1,5 @@ > vp pm cache --help # should show help -Usage: vp pm cache [-- ...] +Usage: vp pm cache [PASS_THROUGH_ARGS]... Manage package cache