Mercurial > hg > MakeItSo
view makeitso/python_package/{{package}}/{{main}}.py @ 193:a42d1aaa81c3
what i meant
author | Jeff Hammel <k0scist@gmail.com> |
---|---|
date | Thu, 08 May 2014 16:55:51 -0700 |
parents | 1bcf60bcc455 |
children | 3cb66c9e5ce8 |
line wrap: on
line source
#!/usr/bin/env python # -*- coding: utf-8 -*- """ {{description}} """ # imports import argparse import os import subprocess import sys __all__ = ['main'] here = os.path.dirname(os.path.realpath(__file__)) string = (str, unicode) class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): """description formatter for console script entry point""" def format_description(self, description): if description: return description.strip() + '\n' else: return '' class Parser(argparse.ArgumentParser): """CLI option parser""" def __init__(self): argparse.ArgumentParser.__init__(self, description=__doc__) def main(args=sys.argv[1:]): """CLI""" # parse command line options parser = Parser() options = parser.parse_args(args) if __name__ == '__main__': main()