Message252250
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. |
|
Date |
User |
Action |
Args |
2015-10-04 01:29:54 | paul.j3 | set | recipients:
+ paul.j3, Sworddragon |
2015-10-04 01:29:54 | paul.j3 | set | messageid: <1443922194.65.0.796168381909.issue25307@psf.upfronthosting.co.za> |
2015-10-04 01:29:54 | paul.j3 | link | issue25307 messages |
2015-10-04 01:29:53 | paul.j3 | create | |
|