Closed juraj-hrivnak closed 2 months ago
Thanks for the clear reproduction.
This is by design; you can't specify parent arguments after a subcommand because it would lead to ambiguity if the subcommand also had any arguments. arg subcommand
is fine because the argument occurs before the subcommand. allowInterspersedArgs
only affects arguments and options, not subcommands.
I see, that makes sense. The issue is that the argument doesn’t work when the subcommand is not used but registered under the parent command.
You need to enable running the parent without children
So that was the trick! Thank you,
When running the
parent
command with any argument:$ ./tool parent arg
, the command is not run, but the help message is printed instead.If we comment out the
this.subcommands(Subcommand())
this starts to work properly.Using
$ ./tool parent arg subcommand
for some reason accepts the argument. That is weird becauseallowInterspersedArgs
is set tofalse
by default.Source code:
Note that I tried both the latest & latest snapshot versions.