Apply raw formatting only to epilog, not to parser and argument group descriptions

Viewed 272

I've defined my program's command-line interface with argparse, and I would like to provide some examples via the epilog. By default, the argparse module strips extra whitespace, wraps the description texts, etc. This default behavior is very useful for the program's description and for the argument group descriptions, but for the epilog I would like to provide a pre-formatted string that the parser should not modify. If I specify formatter_class=RawDescriptionHelpFormatter, this gives the desired behavior for the epilog, but I lose the default behavior I rely on for the program and argument group descriptions. I can go back and manually fix the wrapping of these descriptions, but it's tedious.

Is there a way to apply the raw formatting only to the epilog?

1 Answers
Related