Forest <fores...@sonic.net> added the comment:
Here's another working example, allowing alternate separator strings (as requested in #33389) via subclassing: class OneMetavarHelpFormatter(argparse.HelpFormatter): """A formatter that avoids repeating action metavars. """ OPTION_SEPARATOR = ', ' METAVAR_SEPARATOR = ' ' def _format_action_invocation(self, action): """Format action help without repeating the argument metavar """ 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) options_string = self.OPTION_SEPARATOR.join(action.option_strings) return options_string + self.METAVAR_SEPARATOR + args_string ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45110> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com