Skip to content

Commit

Permalink
Better suggestion for unsupported mode in install command
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Sep 20, 2023
1 parent 7644a4b commit 817c2cb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/bin/cargo/commands/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ pub fn cli() -> Command {
"debug",
"Build in debug mode (with the 'dev' profile) instead of release mode",
))
.arg_unsupported_mode("release", "install", "debug")
.arg_profile("Install artifacts with the specified profile")
.arg_target_triple("Build for the target triple")
.arg_target_dir()
Expand Down
2 changes: 1 addition & 1 deletion src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ Run `{cmd}` to see possible targets."

let name = match (
self.maybe_flag("release"),
self.flag("debug"),
self.maybe_flag("debug"),
specified_profile,
) {
(false, false, None) => default,
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2453,9 +2453,9 @@ fn install_with_unsupported_mode() {
"\
error: unexpected argument '--release' found
tip: a similar argument exists: '--examples'
tip: There is no `--release` for `cargo install`. Only `--debug` is supported.
Usage: cargo[EXE] install --examples [crate]...
Usage: cargo[EXE] install [OPTIONS] [crate]...
For more information, try '--help'.
",
Expand Down

0 comments on commit 817c2cb

Please sign in to comment.