Mercurial > hg > MakeItSo
diff makeitso/template.py @ 58:112bf081148c
make a full CLI class for a single API template
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Thu, 06 Jan 2011 15:54:55 -0800 |
parents | 728cae02a6ed |
children | 30100690ad3f |
line wrap: on
line diff
--- a/makeitso/template.py Thu Jan 06 14:27:09 2011 -0800 +++ b/makeitso/template.py Thu Jan 06 15:54:55 2011 -0800 @@ -14,7 +14,7 @@ class Variable(object): """variable object for MakeItSo templates""" - def __init__(self, name, default=Undefined, description=None, + def __init__(self, name, description=None, default=Undefined, cast=None): self.name = name self.default = default @@ -63,7 +63,8 @@ # inspect the templates for more variables look = False - def __init__(self, output=None, interactive=True, usedefaults=False, **variables): + def __init__(self, output=None, interactive=True, usedefaults=True, + variables=None): """ - output : output file or directory - interactive : whether tointeractively get variables @@ -73,10 +74,10 @@ assert self.templates self.output = output self.interactive = interactive - self.location = os.path.dirnme(os.path.abspath(__file__)) - self.defaults = variables.copy + self.location = os.path.dirname(os.path.abspath(__file__)) + self.defaults = variables.copy() - # make a dictionary of the variables + # make a dictionary of the variables for lookup convenience self.vardict = {} for i in self.vars: self.vardict[i.name] = i