comparison makeitso/python_package/{{package}}/{{main}}.py @ 195:3cb66c9e5ce8

STUB: makeitso/python_package/{{package}}/{{main}}.py
author Jeff Hammel <k0scist@gmail.com>
date Fri, 16 May 2014 23:59:10 -0700
parents 1bcf60bcc455
children d25ca7099df8
comparison
equal deleted inserted replaced
194:41d17337656a 195:3cb66c9e5ce8
9 import argparse 9 import argparse
10 import os 10 import os
11 import subprocess 11 import subprocess
12 import sys 12 import sys
13 13
14 __all__ = ['main'] 14 # module globals
15 __all__ = ['main', 'Parser']
15 here = os.path.dirname(os.path.realpath(__file__)) 16 here = os.path.dirname(os.path.realpath(__file__))
16 string = (str, unicode) 17 string = (str, unicode)
17
18 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
19 """description formatter for console script entry point"""
20 def format_description(self, description):
21 if description:
22 return description.strip() + '\n'
23 else:
24 return ''
25 18
26 19
27 class Parser(argparse.ArgumentParser): 20 class Parser(argparse.ArgumentParser):
28 """CLI option parser""" 21 """CLI option parser"""
29 def __init__(self): 22 def __init__(self):
32 25
33 def main(args=sys.argv[1:]): 26 def main(args=sys.argv[1:]):
34 """CLI""" 27 """CLI"""
35 28
36 # parse command line options 29 # parse command line options
37 parser = Parser() 30 parser = Parser(description=__doc__)
38 options = parser.parse_args(args) 31 options = parser.parse_args(args)
39 32
40 if __name__ == '__main__': 33 if __name__ == '__main__':
41 main() 34 main()