Mercurial > hg > MakeItSo
diff makeitso/cli.py @ 62:30100690ad3f
display defaults with command line --help option
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 Jan 2011 17:49:40 -0800 |
parents | 57f9b0349192 |
children | cce0da329f59 |
line wrap: on
line diff
--- a/makeitso/cli.py Thu Jan 06 17:14:22 2011 -0800 +++ b/makeitso/cli.py Thu Jan 06 17:49:40 2011 -0800 @@ -2,6 +2,7 @@ command line parser for MakeItSo """ +from template import Undefined from optparse import OptionParser class MakeItSoCLI(object): @@ -20,9 +21,12 @@ # add the variables as options for variable in self.template_class.vars: + description = variable.description + if (variable.default is not None) and (variable.default is not Undefined): + description += ' [DEFAULT: %s]' % variable.default parser.add_option('--%s' % variable.name, dest=variable.name, default=variable.default, - help=variable.description) + help=description) return parser def parse(self):