view makeitso/python_module/{{module}}.py @ 156:a7a7c364568a

note on importing; cleanup
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 04 Jul 2013 18:24:13 -0700
parents ebc5cfe17d95
children
line wrap: on
line source

#!/usr/bin/env python

"""
{{module}}
{{description}}
"""

import optparse
import sys

def add_options(parser):
    """add {{module}} options to an OptionParser instance"""


def main(args=sys.argv[1:]):

    # parse command line arguments
    usage = '%prog [options] ...'
    class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
        """description formatter"""
        def format_description(self, description):
            if description:
                return description.strip() + '\n'
            else:
                return ''
    parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
    add_options(parser)
    options, args = parser.parse_args(args)

if __name__ == '__main__':
    main()