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
Incorrect handling of implicit --help option for sub-commands #1368
Not related to CompletionProvider - the trigger is the @CommandGroup prefix.
--help is implicit and never present in a command's getOptions(), so isBooleanOption() in DefaultCommandParser returns false for it and parsing throws. It only appears to work because of the special case near the top of parse(), which handles exactly the two-word input mycmd --help. With prefix = "samples" the full command name is samples bar, so the input is three words, the shortcut is skipped, and it fails. Same for samples foo - the parameter types are irrelevant.
The same gap also mis-parses mycommand --help arg1, where --help silently swallows arg1 as its value.
Fix: have isBooleanOption() treat --help/-h as a boolean flag when no declared option matches that name (the guard keeps commands that use -h for something else working). I have a patch with tests if it's useful.
changed the title [-]--help not working when using a CompletionProvider[/-][+]Incorrect handling of implicit --help option for sub-commands[/+]on Sep 21, 2026
Activity
czpilar commentedon Aug 22, 2026
Not related to
CompletionProvider- the trigger is the@CommandGroupprefix.--helpis implicit and never present in a command'sgetOptions(), soisBooleanOption()inDefaultCommandParserreturnsfalsefor it and parsing throws. It only appears to work because of the special case near the top ofparse(), which handles exactly the two-word inputmycmd --help. Withprefix = "samples"the full command name issamples bar, so the input is three words, the shortcut is skipped, and it fails. Same forsamples foo- the parameter types are irrelevant.The same gap also mis-parses
mycommand --help arg1, where--helpsilently swallowsarg1as its value.Fix: have
isBooleanOption()treat--help/-has a boolean flag when no declared option matches that name (the guard keeps commands that use-hfor something else working). I have a patch with tests if it's useful.czpilar commentedon Aug 22, 2026
Fixed in PR #1369
tschoellhorn commentedon Aug 23, 2026
This is great. Thank you for looking into it!
[-]--help not working when using a CompletionProvider[/-][+]Incorrect handling of implicit --help option for sub-commands[/+]fmbenhassine commentedon Sep 21, 2026
This is a valid issue, thank you for reporting it. Planned it for next release.
@czpilar Thank you for the follow up on this and for contributing a fix!