ConfigArgParse icon indicating copy to clipboard operation
ConfigArgParse copied to clipboard

subcommands and `nargs > 1`

Open fopina opened this issue 1 year ago • 3 comments

These lines: here and here

These always place env and config file variables at the end of argv, when any config used has nargs > 1.

While it does not make any difference in most cases, it does when subparsers are used.

If parent parser has one of these flags and it is used via env/configfile, it is moved to the end of argv, after the subparser, making them options of the subparser, not the parent one (and failing to parse args).

Not sure I understand the reason behind this logic so unable to propose a fix / submit PR.

I assume best way would be to rebuild argv based on all the parser definitions rather than assuming where to put the flags

fopina avatar Jul 14 '22 22:07 fopina