Skip to content

Commit 9117ec9

Browse files
committed
fix(update): Perform error check in clap
1 parent e290ed7 commit 9117ec9

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/bin/cargo/commands/update.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,13 @@ pub fn cli() -> Command {
99
.arg_quiet()
1010
.arg(flag("workspace", "Only update the workspace packages").short('w'))
1111
.arg_package_spec_simple("Package to update")
12-
.arg(flag(
13-
"aggressive",
14-
"Force updating all dependencies of SPEC as well when used with -p",
15-
))
12+
.arg(
13+
flag(
14+
"aggressive",
15+
"Force updating all dependencies of SPEC as well when used with -p",
16+
)
17+
.conflicts_with("precise"),
18+
)
1619
.arg_dry_run("Don't actually write the lockfile")
1720
.arg(
1821
opt(

tests/testsuite/update.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,14 @@ fn update_aggressive_conflicts_with_precise() {
491491
Package::new("serde", "0.2.2").dep("log", "0.1").publish();
492492

493493
p.cargo("update -p serde:0.2.1 --precise 0.2.2 --aggressive")
494-
.with_status(101)
494+
.with_status(1)
495495
.with_stderr(
496496
"\
497-
error: cannot specify both aggressive and precise simultaneously
497+
error: the argument '--precise <PRECISE>' cannot be used with '--aggressive'
498+
499+
Usage: cargo update --package [<SPEC>] --precise <PRECISE>
500+
501+
For more information, try '--help'.
498502
",
499503
)
500504
.run();

0 commit comments

Comments
 (0)