Closed agilly closed 1 year ago
Looking at the behavior of python's argparse
module it doesn't support multiline descriptions. However it will quietly convert any newlines into spaces instead of throwing an error.
import argparse
parser = argparse.ArgumentParser(description="Description of tool.\n\nAuthor info")
parser.parse_args()
usage: argparse_test.py [-h]
Description of tool. Author info
optional arguments:
-h, --help show this help message and exit
Currently {argparse}
is simply a wrapper around Python's argparse
module so it wouldn't be straightforward to add multiline descriptions but it is probably feasible to quietly convert those newlines to spaces.
Thanks for the explanation and fix @trevorld !
After f22b70c46c337 multiline descriptions should work but (like with Python) you'll need to use formatter_class='argparse.RawDescriptionHelpFormatter'
:
library("argparse")
parser <- ArgumentParser(description="Description of tool.\nAuthor information.",
formatter_class='argparse.RawDescriptionHelpFormatter')
parser$print_help()
usage: PROGRAM [-h]
Description of tool.
Author information.
optional arguments:
-h, --help show this help message and exit
Using multiline descriptions at initialisation, like:
produces an error:
I am not sure you want to support multiline descriptions (it kind of makes sense to IMO?) but in any case the error message should probably be made clearer.
R 4.2.1, python version 3.6.9