comparison makeitso/cli.py @ 77:059b02808efa

ensure the description exists
author Jeff Hammel <jhammel@mozilla.com>
date Sat, 08 Jan 2011 16:21:29 -0800
parents cce0da329f59
children cb6c54b1adf3
comparison
equal deleted inserted replaced
76:7909dfaef33b 77:059b02808efa
20 parser = OptionParser(usage=usage, description=description) 20 parser = OptionParser(usage=usage, description=description)
21 21
22 # add the variables as options 22 # add the variables as options
23 for variable in self.template_class.vars: 23 for variable in self.template_class.vars:
24 description = variable.description 24 description = variable.description
25 if (variable.default is not None) and (variable.default is not Undefined): 25 if (variable.default is not None) and (variable.default is not Undefined) and description is not None:
26 description += ' [DEFAULT: %s]' % variable.default 26 description += ' [DEFAULT: %s]' % variable.default
27 parser.add_option('--%s' % variable.name, dest=variable.name, 27 parser.add_option('--%s' % variable.name, dest=variable.name,
28 default=variable.default, 28 default=variable.default,
29 help=description) 29 help=description)
30 return parser 30 return parser