Inside my project I'm mostly using docopt, but to overcome a limitation I'm switching to argparse for one function. However, for consistency I want to still print my own doc-string when I type -h or --help. Surprisingly I cannot find how to do that.
This doesn't work:
parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, help=__doc__) as it gives
argparse.ArgumentError: argument -h/--help: conflicting option strings: -h, --help But what do I have to put?
argparsewould print the docstring, I don't want to add an option on top of it. But maybe I'm overlooking something?--helpis included by default; so that's why adding your own produces a conflict. There is aArgumentParserparameter to turns off the automatic help argument. Specifying thehelp=__doc__doesn't help since the just changes the help line in the conventional help display. It doesn't change the whole display.