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
This handles outputting for nested sub-parsers.
First we modify the load_sub_parsers iterator to check if any of the
arguments are subparsers, and if so, recurse into that subparser and
yield its values back too. (I am as skeptical of yielding from
recursive generator functions as anyone :) If you have hundreds of
levels of nested subparsers I guess this blows up ... but that seems
impractical).
In _mk_sub_command, avoid adding subparsers so they don't show up as
positional arguments (their Action has action.dest of "==SUPPRESS=="
which looks wrong and they don't show up in cmd line help). The
subparsers are listed in the usage-string, e.g.
test subparser [-h] [--foo FOO] {child_two} ...
In _build_opt_grp_title we are taking elements[:2] as the title text
for the option group. This ends up cutting off the full title when
you have nested subparsers. I have to admit I can't really determine
why this is done, but it does not seem to affect any of the test cases
and the output looks correct to me for nested subparsers, with the
full command listed as the option title.
0 commit comments