Created
April 2, 2016 13:43
-
-
Save raggleton/7ce0340b2444f134b35b1183ae4c2d7d to your computer and use it in GitHub Desktop.
Make argparse respect formatting AND show defaults. From https://stackoverflow.com/questions/18462610/argumentparser-epilog-and-description-formatting-in-conjunction-with-argumentdef
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CustomFormatter(argparse.ArgumentDefaultsHelpFormatter, argparse.RawDescriptionHelpFormatter): | |
pass | |
parser = argparse.ArgumentParser(description='test\ntest\ntest.', | |
epilog='test\ntest\ntest.', | |
formatter_class=CustomFormatter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment