Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion crates/vite_pm_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Vec<String>>,
},

Expand Down Expand Up @@ -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"])
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/snap-tests-global/command-cache-bun/snap.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
> vp pm cache --help # should show help
Usage: vp pm cache <SUBCOMMAND> [-- <PASS_THROUGH_ARGS>...]
Usage: vp pm cache <SUBCOMMAND> [PASS_THROUGH_ARGS]...

Manage package cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
> vp pm cache --help # should show help
Usage: vp pm cache <SUBCOMMAND> [-- <PASS_THROUGH_ARGS>...]
Usage: vp pm cache <SUBCOMMAND> [PASS_THROUGH_ARGS]...

Manage package cache

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
> vp pm cache --help # should show help
Usage: vp pm cache <SUBCOMMAND> [-- <PASS_THROUGH_ARGS>...]
Usage: vp pm cache <SUBCOMMAND> [PASS_THROUGH_ARGS]...

Manage package cache

Expand Down
Loading