Mercurial > hg > MakeItSo
annotate makeitso/python_package/{{package}}/main.py @ 140:3046e15c3dd7
fix up sectioning
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 21 Feb 2012 21:06:11 -0800 |
parents | 23652cbfdfad |
children | d37ee77a9317 |
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: | |
18 return description + '\n' | |
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() |