This question is related to a question asked earlier, but might be unrelated. Question is: How to use newlines in the help text in the given (working) example below, when using subparsers?
import argparse
parser = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter)
subparsers = parser.add_subparsers()
parser_start = subparsers.add_parser('stop')
parser_start.add_argument("file", help = "firstline\nnext line\nlast line")
print parser.parse_args()
My output is as follows:
tester.py stop -h
usage: tester.py stop [-h] file
positional arguments:
file firstline next line last line
optional arguments:
-h, --help show this help message and exit
The expected output for the help on file
should be:
first line
next line
last line