Skip to content

Commit cc6b437

Browse files
committed
feat: check cargo uninstall package opt with empty value
1 parent c347745 commit cc6b437

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/bin/cargo/commands/uninstall.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ pub fn cli() -> App {
1515

1616
pub fn exec(config: &mut Config, args: &ArgMatches<'_>) -> CliResult {
1717
let root = args.value_of("root");
18+
19+
if args.is_present_with_zero_values("package") {
20+
return Err(anyhow::anyhow!(
21+
"\"--package <SPEC>\" requires a SPEC format value.\n\
22+
Run `cargo help pkgid` for more information about SPEC format."
23+
).into())
24+
}
25+
1826
let specs = args
1927
.values_of("spec")
2028
.unwrap_or_else(|| args.values_of("package").unwrap_or_default())

0 commit comments

Comments
 (0)