Mercurial > hg > MakeItSo
comparison makeitso/python_package/{{package}}/{{main}}.py @ 160:9033a5f11b92
wip
| author | Jeff Hammel <jhammel@mozilla.com> |
|---|---|
| date | Tue, 30 Jul 2013 15:29:56 -0700 |
| parents | makeitso/python_package/{{package}}/main.py@cfd4f1e91090 |
| children | a5d058957734 |
comparison
equal
deleted
inserted
replaced
| 159:cfd4f1e91090 | 160:9033a5f11b92 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 # -*- coding: utf-8 -*- | |
| 3 | |
| 4 """ | |
| 5 {{description}} | |
| 6 """ | |
| 7 | |
| 8 import optparse | |
| 9 import os | |
| 10 import subprocess | |
| 11 import sys | |
| 12 | |
| 13 def add_options(parser): | |
| 14 """add {{package}} options to an OptionParser instance""" | |
| 15 | |
| 16 def main(args=sys.argv[1:]): | |
| 17 | |
| 18 # parse command line options | |
| 19 usage = '%prog [options] ...' | |
| 20 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): | |
| 21 """description formatter for console script entry point""" | |
| 22 def format_description(self, description): | |
| 23 if description: | |
| 24 return description.strip() + '\n' | |
| 25 else: | |
| 26 return '' | |
| 27 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) | |
| 28 options, args = parser.parse_args(args) | |
| 29 | |
| 30 if __name__ == '__main__': | |
| 31 main() |
