argh icon indicating copy to clipboard operation
argh copied to clipboard

Help subcommand suggested even when disabled

Open gorilskij opened this issue 6 months ago • 0 comments

When a subcommand is added to a command such as in the following example

use argh::FromArgs;

#[derive(FromArgs)]
// note that we disable the default `help` subcommand
#[argh(help_triggers("-h", "--help"))]
///
struct Command {
    #[argh(subcommand)]
    subcommand: Subcommand,
}

#[derive(FromArgs)]
#[argh(subcommand, name = "subcommand")]
///
struct Subcommand {}

fn main() {
    let _: Command = argh::from_env();
}

if the command is run without providing a subcommand, the error message is

One of the following subcommands must be present:
    help
    subcommand

Run command --help for more information.

even though we disabled the help subcommand.

Running command help correctly gives an error message saying unrecognized argument. The problem is only the suggestion to use the help subcommand even if it's not available.

Probably related to #184

gorilskij avatar Jul 09 '25 22:07 gorilskij