comparison makeitso/python_module/{{module}}.py @ 142:a203f79c537f

better organization
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 29 Feb 2012 10:59:11 -0800
parents d9201f911458
children 88f5bab340a1
comparison
equal deleted inserted replaced
141:4ee086606772 142:a203f79c537f
9 9
10 def main(args=sys.argv[1:]): 10 def main(args=sys.argv[1:]):
11 11
12 # parse command line arguments 12 # parse command line arguments
13 usage = '%prog [options] ...' 13 usage = '%prog [options] ...'
14
15 # description formatter
16 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter): 14 class PlainDescriptionFormatter(optparse.IndentedHelpFormatter):
15 """description formatter"""
17 def format_description(self, description): 16 def format_description(self, description):
18 if description: 17 if description:
19 return description + '\n' 18 return description + '\n'
20 else: 19 else:
21 return '' 20 return ''
22
23 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter()) 21 parser = optparse.OptionParser(usage=usage, description=__doc__, formatter=PlainDescriptionFormatter())
24 options, args = parser.parse_args(args) 22 options, args = parser.parse_args(args)
25 23
26 if __name__ == '__main__': 24 if __name__ == '__main__':
27 main() 25 main()