paul j3 <[email protected]> added the comment:
I've reviewed the comments and proposed patch, and still think that the custom
metavar is still the best fix.
subparses.metavar can be changed after subparsers has been created. The
programmer could, for example, write a simple helper function that calls
add_parser, and also appends names to a list. Then at the end, turn that list
into a properly formatted metavar string.
subparsers.metavar = '(%s}'%','.join(['cmd1','foo','cmd3'])
In fact, if I were to write a patch, I'd take this approach, trying to confine
all changes to the _SubParsersAction.add_parser method, and out of the
HelpFormatter.
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue22848>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com