Mercurial > hg > MakeItSo
annotate makeitso/python_package/{{package}}/main.py @ 146:ebaee69c5ea4
whitespace
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Mon, 05 Mar 2012 14:32:21 -0800 |
parents | 3046e15c3dd7 |
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() |