Skip to content

Commit 817c2cb

Browse files
committed
Better suggestion for unsupported mode in install command
1 parent 7644a4b commit 817c2cb

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

src/bin/cargo/commands/install.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ pub fn cli() -> Command {
8383
"debug",
8484
"Build in debug mode (with the 'dev' profile) instead of release mode",
8585
))
86+
.arg_unsupported_mode("release", "install", "debug")
8687
.arg_profile("Install artifacts with the specified profile")
8788
.arg_target_triple("Build for the target triple")
8889
.arg_target_dir()

src/cargo/util/command_prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ Run `{cmd}` to see possible targets."
525525

526526
let name = match (
527527
self.maybe_flag("release"),
528-
self.flag("debug"),
528+
self.maybe_flag("debug"),
529529
specified_profile,
530530
) {
531531
(false, false, None) => default,

tests/testsuite/install.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2453,9 +2453,9 @@ fn install_with_unsupported_mode() {
24532453
"\
24542454
error: unexpected argument '--release' found
24552455
2456-
tip: a similar argument exists: '--examples'
2456+
tip: There is no `--release` for `cargo install`. Only `--debug` is supported.
24572457
2458-
Usage: cargo[EXE] install --examples [crate]...
2458+
Usage: cargo[EXE] install [OPTIONS] [crate]...
24592459
24602460
For more information, try '--help'.
24612461
",

0 commit comments

Comments
 (0)