[issue42980] argparse: GNU-style help formatter
paul j3
report at bugs.python.org
Fri Jan 22 14:08:35 EST 2021
paul j3 <ajipanca at gmail.com> added the comment:
I was thinking of a refactoring that included the ', '.join(...) loop, but on further thought your refactoring might be enough for the case I raised.
For example:
def _format_option_with_args(self, option_string, args_string):
if option_string.startswith('--'):
return '%s %s' % (option_string, args_string)
return '%s' % option_string
would produce a
-f, --foo FOO something
and
def _format_option_with_args(self, option_string, args_string):
return option_string
would produce
-f, --foo something
I wonder if this refactoring merits some mention in the documentation. Or maybe the GnuStyleLongOptionsHelpFormatter subclass is enough of an example. The details of how other formatter subclasses work aren't documented, but they are available to developers who can read the code.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42980>
_______________________________________
More information about the Python-bugs-list
mailing list