-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-cli-helpArea: built-in command-line helpArea: built-in command-line helpA-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationC-bugCategory: bugCategory: bugZ-cargo-configNightly: cargo config subcommandNightly: cargo config subcommand
Description
Problem
Confusing output when running cargo help config
:
$ cargo help config
error: no such subcommand: `config`
Did you mean `config`?
View all installed commands with `cargo --list`
Steps
- Run
cargo help config
Possible Solution(s)
There doesn't seem to be a man page for cargo config
: https://github.com/rust-lang/cargo/tree/master/src/doc/man
This results in extract_man
to return None
, which results in try_help
returning Ok(false)
:
cargo/src/bin/cargo/commands/help.rs
Lines 61 to 63 in 995f5ef
let man = match extract_man(subcommand, "1") { | |
Some(man) => man, | |
None => return Ok(false), |
This in turn makes exec
return the confusing message:
cargo/src/bin/cargo/commands/help.rs
Lines 24 to 29 in 995f5ef
if !try_help(config, subcommand)? { | |
crate::execute_external_subcommand( | |
config, | |
subcommand, | |
&[OsStr::new(subcommand), OsStr::new("--help")], | |
)?; |
I'd propose the following fixes:
- Differentiate between the command not being found and the man page not being found. If the man page couldn't be found, a different message should be returned.
- Add the man page for
cargo config
.
Notes
No response
Version
cargo 1.65.0 (4bc8f24d3 2022-10-20)
release: 1.65.0
commit-hash: 4bc8f24d3e899462e43621aab981f6383a370365
commit-date: 2022-10-20
host: x86_64-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.15.0 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1q)
os: Pop!_OS 22.04 (jammy) [64-bit]
sir4ur0n
Metadata
Metadata
Assignees
Labels
A-cli-helpArea: built-in command-line helpArea: built-in command-line helpA-documenting-cargo-itselfArea: Cargo's documentationArea: Cargo's documentationC-bugCategory: bugCategory: bugZ-cargo-configNightly: cargo config subcommandNightly: cargo config subcommand