You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
help subcommand listed on help pages is refused by the usage-lib parser #1636
The help page of every command with subcommands lists help Print this message or the help of the given subcommand(s),
but the usage-lib parser (usage bash, usage explain, …) refuses that word there:
#!/usr/bin/env -S usage bash#USAGE name "x"#USAGE bin "x"#USAGE cmd "a" {#USAGE cmd "b"#USAGE }echo ran
$ ./x.sh --helpUsage: x [SUBCOMMAND]Commands: a help Print this message or the help of the given subcommand(s)Flags: -h, --help Print help
$ ./x.sh helpError: unexpected word: help
$ ./x.sh help aError: unexpected word: help
$ ./x.sh a helpError: unexpected word: help
On a leaf, where the page does not list it, the word is taken as a help request instead: ./x.sh a b help prints the page of x a b on stderr after Error: and exits 1.
Expected: what usage-argv does since #872 — help [command...] answers with the long help of the named command wherever there are
subcommands, and to a leaf help is an ordinary word.
The condition in is_help_arg (lib/src/parse.rs:5544 on main) is the opposite of the one in argv/src/lib.rs:2813: cmd.subcommands.is_empty() against !self.cmd.subcommands.is_empty().
The usage-lib rule predates #872 (#1123 moved it from the root to the current command)
and was not updated with it.
Activity
github-actions commentedon Nov 16, 2026
Fixed in v7.4.0 by #1639.