Mercurial > hg > MakeItSo
annotate makeitso/python_package/{{package}}/main.py @ 139:23652cbfdfad
whitespace
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 21 Feb 2012 21:02:33 -0800 |
parents | d9201f911458 |
children | 3046e15c3dd7 |
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]' | |
130
d9201f911458
better description formatting
Jeff Hammel <jhammel@mozilla.com>
parents:
79
diff
changeset
|
14 |
139 | 15 # description formatter |
16 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): | |
17 def format_description(self, description): | |
18 if description: | |
19 return description + '\n' | |
20 else: | |
21 return '' | |
22 | |
23 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | |
24 options, args = parser.parse_args(args) | |
79 | 25 |
26 if __name__ == '__main__': | |
139 | 27 main() |