Skip to content

Commit

Permalink
Auto merge of #12592 - epage:explain, r=weihanglo
Browse files Browse the repository at this point in the history
fix(help): Explain --explain

In working on #12578, I'm focusing on each help string to decide how it should be handled and I noticed this.  It feels weird to explain something in terms of another command's CLI, so I took `rustc --help`s message and added `rustc` to clarify it.

Looking back, the flag was added in #2551 with the message we have today.  Nothing seems to really be said about it.

In reflecting on this, I'm not 100% convinced and am open to other opinions.
  • Loading branch information
bors committed Aug 29, 2023
2 parents 333ca23 + d893056 commit 633a91a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/bin/cargo/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,13 @@ See 'cargo help <command>' for more information on a specific command.\n",
)
.arg(flag("version", "Print version info and exit").short('V'))
.arg(flag("list", "List installed commands"))
.arg(opt("explain", "Run `rustc --explain CODE`").value_name("CODE"))
.arg(
opt(
"explain",
"Provide a detailed explanation of a rustc error message",
)
.value_name("CODE"),
)
.arg(
opt(
"verbose",
Expand Down
2 changes: 1 addition & 1 deletion tests/testsuite/cargo/help/stdout.log
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Usage: cargo [..][OPTIONS] [COMMAND]
Options:
-V, --version Print version info and exit
--list List installed commands
--explain <CODE> Run `rustc --explain CODE`
--explain <CODE> Provide a detailed explanation of a rustc error message
-v, --verbose... Use verbose output (-vv very verbose/build.rs output)
-q, --quiet Do not print cargo log messages
--color <WHEN> Coloring: auto, always, never
Expand Down

0 comments on commit 633a91a

Please sign in to comment.