When --help is used on a group command (a @CommandDefinition with groupCommands), aesh prints The option --help is unknown. before rendering the help output:
$ hardwood inspect --help
The option --help is unknown.
Low-level introspection commands.
Usage: hardwood inspect [-h] [COMMAND]
...
The help renders correctly (exit code 0), but the spurious error message is confusing. This only happens on nested group commands — the root command hardwood --help and leaf commands like hardwood print --help work cleanly without the error.
Expected behavior
hardwood inspect --help should render the help output without any error prefix — identical to how hardwood --help and hardwood print --help behave.
Root cause
When generateHelp = true, aesh adds a -h/--help option to the command. For leaf commands and the root command, this works correctly. But for a nested group command, the parser appears to reject --help as an unknown option before the help system processes it. The help still renders (possibly via a fallback path), but the error message leaks through to stderr.
Reproduction
@CommandDefinition(name = "root", description = "Root", generateHelp = true, groupCommands = {
GroupCmd.class
})
public class RootCommand implements Command<CommandInvocation> { ... }
@CommandDefinition(name = "group", description = "Group", generateHelp = true, groupCommands = {
LeafCmd.class
})
public class GroupCmd implements Command<CommandInvocation> { ... }
@CommandDefinition(name = "leaf", description = "Leaf", generateHelp = true)
public class LeafCmd implements Command<CommandInvocation> { ... }
$ app group --help # prints "unknown option" + help (BUG)
$ app --help # prints help only (OK)
$ app group leaf --help # prints help only (OK)
Context
Found in hardwood-hq/hardwood issue #806 after the picocli-to-aesh migration.
When
--helpis used on a group command (a@CommandDefinitionwithgroupCommands), aesh printsThe option --help is unknown.before rendering the help output:The help renders correctly (exit code 0), but the spurious error message is confusing. This only happens on nested group commands — the root command
hardwood --helpand leaf commands likehardwood print --helpwork cleanly without the error.Expected behavior
hardwood inspect --helpshould render the help output without any error prefix — identical to howhardwood --helpandhardwood print --helpbehave.Root cause
When
generateHelp = true, aesh adds a-h/--helpoption to the command. For leaf commands and the root command, this works correctly. But for a nested group command, the parser appears to reject--helpas an unknown option before the help system processes it. The help still renders (possibly via a fallback path), but the error message leaks through to stderr.Reproduction
Context
Found in hardwood-hq/hardwood issue #806 after the picocli-to-aesh migration.