Mercurial > hg > MakeItSo
comparison makeitso/python_package/{{package}}/{{main}}.py @ 206:d9d7bfdb54db
http://stackoverflow.com/questions/4375327/python-argparse-preformatted-help-text
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Fri, 21 Nov 2014 14:36:17 -0800 |
parents | 0a991b8fe839 |
children | 04c5464355b8 |
comparison
equal
deleted
inserted
replaced
205:0a991b8fe839 | 206:d9d7bfdb54db |
---|---|
27 | 27 |
28 | 28 |
29 class Parser(argparse.ArgumentParser): | 29 class Parser(argparse.ArgumentParser): |
30 """CLI option parser""" | 30 """CLI option parser""" |
31 def __init__(self, **kwargs): | 31 def __init__(self, **kwargs): |
32 kwargs.setdefault('formatter_class', argparse.RawTextHelpFormatter) | |
32 kwargs.setdefault('description', __doc__) | 33 kwargs.setdefault('description', __doc__) |
33 argparse.ArgumentParser.__init__(self, **kwargs) | 34 argparse.ArgumentParser.__init__(self, **kwargs) |
34 self.options = None | 35 self.options = None |
35 | 36 |
36 def parse_args(self, *args, **kw): | 37 def parse_args(self, *args, **kw): |