diff options
-rw-r--r-- | src/scadere/__init__.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/scadere/__init__.py b/src/scadere/__init__.py index 7becab1..ada0f29 100644 --- a/src/scadere/__init__.py +++ b/src/scadere/__init__.py @@ -16,7 +16,7 @@ # You should have received a copy of the GNU Affero General Public License # along with scadere. If not, see <https://www.gnu.org/licenses/>. -from argparse import HelpFormatter +from argparse import HelpFormatter, ONE_OR_MORE __all__ = ['__version__', 'GNUHelpFormatter', 'NetLoc'] __version__ = '0.1.0' @@ -33,6 +33,13 @@ class GNUHelpFormatter(HelpFormatter): """Substitute 'Options:' for 'options:'.""" super().start_section(heading.capitalize()) + def _format_args(self, action, default_metavar): + """Substitute 'METAVAR...' for 'METAVAR [METAVAR ...]'.""" + if action.nargs == ONE_OR_MORE: + get_metavar = self._metavar_formatter(action, default_metavar) + return '{}...'.format(*get_metavar(1)) + return super()._format_args(action, default_metavar) + def _format_action_invocation(self, action): """Format --long-option=argument.""" if not action.option_strings or action.nargs is not None: |