[New-bugs-announce] [issue43942] RawDescriptionHelpFormatter seems to be ignored for argument descriptions
Reuben Thomas
report at bugs.python.org
Mon Apr 26 05:29:05 EDT 2021
New submission from Reuben Thomas <rrt at sc3d.org>:
The documentation seems very clear on this subject:
"RawTextHelpFormatter maintains whitespace for all sorts of help text, including argument descriptions. However, multiple new lines are replaced with one."
But consider the following code:
```
from argparse import ArgumentParser, RawDescriptionHelpFormatter
parser = ArgumentParser(
description='A simple templating system.',
epilog='Use `-\' as a file name to indicate standard input or output.',
formatter_class=RawDescriptionHelpFormatter,
)
parser.add_argument(
'--verbose',
help='show on standard error the path being built,\nand the names of files built, included and pasted'
)
args = parser.parse_args()
```
Then try running it in a suitably-sized terminal:
$ python3 test.py --help
usage: test.py [-h] [--verbose VERBOSE]
A simple templating system.
optional arguments:
-h, --help show this help message and exit
--verbose VERBOSE show on standard error the path being built, and the names of files built, included and pasted
Use `-' as a file name to indicate standard input or output.
```
The \n in the help for the `--verbose` argument is not respected.
----------
components: Library (Lib)
messages: 391890
nosy: rrt
priority: normal
severity: normal
status: open
title: RawDescriptionHelpFormatter seems to be ignored for argument descriptions
versions: Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43942>
_______________________________________
More information about the New-bugs-announce
mailing list