Message315713
This subclass makes are one method change:
from:
def _get_help_string(self, action):
return action.help
to:
def _get_help_string(self, action):
help = action.help
if '%(default)' not in action.help:
if action.default is not SUPPRESS:
defaulting_nargs = [OPTIONAL, ZERO_OR_MORE]
if action.option_strings or action.nargs in defaulting_nargs:
help += ' (default: %(default)s)'
return help
So it conditionally adds a '%(default)s' to the help string.
And in:
def _expand_help(self, action):
...
return self._get_help_string(action) % params
where 'params' is derived from the attributes of the 'Action' object.
I don't off hand see a clean way of suppressing this addition. We don't want to add a parameter to 'add_argument' just for this.
As a user you can explicitly add the `%(default)s` to selected arguments, and use the regular formatter. Admittedly it involves a bit more typing.
Or write your own version of the formatter subclass. |
|
Date |
User |
Action |
Args |
2018-04-24 19:05:46 | paul.j3 | set | recipients:
+ paul.j3, elypter |
2018-04-24 19:05:46 | paul.j3 | set | messageid: <1524596746.85.0.682650639539.issue32552@psf.upfronthosting.co.za> |
2018-04-24 19:05:46 | paul.j3 | link | issue32552 messages |
2018-04-24 19:05:46 | paul.j3 | create | |
|