paul j3 added the comment:
Formatter _format_action_invocation(self, action) is the key function. Notice
how it treats positionals and optionals separately. Also it calls
default = self._get_default_metavar_for_optional(action)
args_string = self._format_args(action, default)
to get the string that is placed after each option_string.
'choices' are incorporated via the _metavar_formatter() method (through several
function calls). They do not get their own separate consideration. Tracing
this calling stack is not a trivial task.
But if you want custom behavior at this point in the help,
_format_action_invocation() is the function to play with. You could even add
the space for a nonexistent short option at this point.
http://bugs.python.org/issue16468 is an example of a 'choices' thread. Note
that a formatted list of choices is also shown in the 'usage' and error
messages. It's about formatting the choices string, not about where to show it.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue25307>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com