command-line-api icon indicating copy to clipboard operation
command-line-api copied to clipboard

Calling --help on a subcommand does not work

Open hammypants opened this issue 2 months ago • 3 comments

Using the tutorial as an example: calling the app with read --help throws a stack overflow exception.

It looks like it's calling validation on arguments regardless of whether help was invoked or not when DefaultValueFactory is set.

Package version: [email protected]

This is close to #2707 (which probably shouldn't be closed), but there is no similar recourse in this situation that I can tell. One is not using class configuration, nor is overriding help or version options.

hammypants avatar Oct 21 '25 20:10 hammypants

Many CLI's tend to use a help subcommand. For example: myapp help <subcommand> to get help for sub-commands, whereas myapp --help would give general, "top-level" help about myapp. Programs that do this, for example, are git, ip, and even kubernetes.

fourpastmidnight avatar Nov 14 '25 13:11 fourpastmidnight

Many CLI's tend to use a help subcommand. For example: myapp help <subcommand> to get help for sub-commands, whereas myapp --help would give general, "top-level" help about myapp. Programs that do this, for example, are git, ip, and even kubernetes.

git status --help kubectl get --help

@hammypants request seems legitimate

danvy avatar Nov 20 '25 14:11 danvy

We did this in the dotnet CLI so that we could treat dotnet help <args> specially and open online detailed help for the specific command, if folks want to take inspiration from that.

baronfel avatar Nov 20 '25 14:11 baronfel

Many CLI's tend to use a help subcommand. For example: myapp help <subcommand> to get help for sub-commands, whereas myapp --help would give general, "top-level" help about myapp. Programs that do this, for example, are git, ip, and even kubernetes.

I'm aware. But their tutorial states it should work the way @danvy has listed it. In the subcommands and options section:

Image

hammypants avatar Dec 12 '25 19:12 hammypants