paul j3 added the comment:
http://stackoverflow.com/questions/18275023/dont-show-long-options-twice-in-print-help-from-argparse
Once answer demonstrates how to change the Formatter:
class CustomHelpFormatter(argparse.HelpFormatter):
def _format_action_invocation(self, action):
if not action.option_strings or action.nargs == 0:
return super()._format_action_invocation(action)
default = self._get_default_metavar_for_optional(action)
args_string = self._format_args(action, default)
return ', '.join(action.option_strings) + ' ' + args_string
Another answer suggests using metavar=''.
Another SO question with a few more links:
http://stackoverflow.com/questions/23936145/python-argparse-help-message-disable-metavar-for-short-options
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue27303>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com