Skip to content

cargo help config doesn't recognize config command #11408

@TimJentzsch

Description

@TimJentzsch

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

  1. 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):

let man = match extract_man(subcommand, "1") {
Some(man) => man,
None => return Ok(false),

This in turn makes exec return the confusing message:

if !try_help(config, subcommand)? {
crate::execute_external_subcommand(
config,
subcommand,
&[OsStr::new(subcommand), OsStr::new("--help")],
)?;

I'd propose the following fixes:

  1. 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.
  2. 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]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions