This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author paul.j3
Recipients bethard, memeplex, paul.j3
Date 2016-06-13.01:44:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1465782300.78.0.622098947068.issue27303@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2016-06-13 01:45:00paul.j3setrecipients: + paul.j3, bethard, memeplex
2016-06-13 01:45:00paul.j3setmessageid: <1465782300.78.0.622098947068.issue27303@psf.upfronthosting.co.za>
2016-06-13 01:45:00paul.j3linkissue27303 messages
2016-06-13 01:44:59paul.j3create