[issue42023] Argparse: Add a "display" arg

ThatXliner report at bugs.python.org
Wed Oct 14 14:45:07 EDT 2020


ThatXliner <bryan.hu.2020 at gmail.com> added the comment:

> So if you can get by with just customizing _format_action_invocation, there's no need for further action here.

Then maybe we could just make a new function that takes 2 arguments: Name of another action class (or the action class itself), and a tuple of the arg names to be displayed. It returns a new action class that contains the help text properties of the given action class with customized displayed arg names.


Maybe like

parser.add_argument("-f", "--foo", action=argparse.CustomArgName(action="store_true", name=("-F!!", "--FOO!"), help="TO foo a bar"))

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42023>
_______________________________________


More information about the Python-bugs-list mailing list