[issue9399] Provide a 'print' action for argparse
Steven Bethard
report at bugs.python.org
Thu Feb 10 08:20:04 CET 2011
Steven Bethard <steven.bethard at gmail.com> added the comment:
Argparse's wrapping behavior is determined by the formatter_class:
http://docs.python.org/library/argparse.html#formatter-class
Is it reasonable to assume that if you're wrapping your own messages you're already specifying formatter_class=argparse.RawTextHelpFormatter? If so, then perhaps the message should be printed via something like:
formatter = parser._get_formatter()
formatter.add_text(self.message)
file.write(formatter.format_help())
This is what we do in _VersionAction, so I guess it's probably what we should do here.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9399>
_______________________________________
More information about the Python-bugs-list
mailing list