Mercurial > hg > MakeItSo
annotate makeitso/python_package/{{package}}/main.py @ 153:a5ea79f3221f
.strip() the description
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 01 Dec 2012 19:15:48 -0800 |
parents | d37ee77a9317 |
children | 386a44a52139 |
rev | line source |
---|---|
79 | 1 #!/usr/bin/env python |
2 | |
3 """ | |
4 {{description}} | |
5 """ | |
6 | |
7 import sys | |
130
d9201f911458
better description formatting
Jeff Hammel <jhammel@mozilla.com>
parents:
79
diff
changeset
|
8 import optparse |
79 | 9 |
10 def main(args=sys.argv[:]): | |
130
d9201f911458
better description formatting
Jeff Hammel <jhammel@mozilla.com>
parents:
79
diff
changeset
|
11 |
139 | 12 # parse command line options |
13 usage = '%prog [options]' | |
14 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): | |
140 | 15 """description formatter for console script entry point""" |
139 | 16 def format_description(self, description): |
17 if description: | |
149 | 18 return description.strip() + '\n' |
139 | 19 else: |
20 return '' | |
21 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | |
22 options, args = parser.parse_args(args) | |
79 | 23 |
24 if __name__ == '__main__': | |
139 | 25 main() |