[issue11695] Improve argparse usage/help customization
paul j3
report at bugs.python.org
Sat Jun 21 21:01:31 CEST 2014
paul j3 added the comment:
That original template can also be implemented with a customized 'format_help':
def custom_help(self):
formatter = self._get_formatter()
formatter.add_text('My Program, version 3.5')
formatter.add_usage(self.usage, self._actions,
self._mutually_exclusive_groups,
prefix='Usage: ')
formatter.add_text('Some description of my program')
for action_group in self._action_groups:
with formatter.add_section(action_group.title):
formatter.add_text(action_group.description)
formatter.add_arguments(action_group._group_actions)
formatter.add_text('My epilog text')
return formatter.format_help()
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11695>
_______________________________________
More information about the Python-bugs-list
mailing list