diff options
Diffstat (limited to 'mako/cmd.py')
-rwxr-xr-x | mako/cmd.py | 21 |
1 files changed, 13 insertions, 8 deletions
diff --git a/mako/cmd.py b/mako/cmd.py index 1a9ca56..50d47fc 100755 --- a/mako/cmd.py +++ b/mako/cmd.py @@ -10,26 +10,31 @@ from mako.template import Template from mako.lookup import TemplateLookup from mako import exceptions + def varsplit(var): if "=" not in var: return (var, "") return var.split("=", 1) + def _exit(): sys.stderr.write(exceptions.text_error_template().render()) sys.exit(1) + def cmdline(argv=None): parser = ArgumentParser("usage: %prog [FILENAME]") - parser.add_argument("--var", default=[], action="append", - help="variable (can be used multiple times, use name=value)") - parser.add_argument("--template-dir", default=[], action="append", - help="Directory to use for template lookup (multiple " - "directories may be provided). If not given then if the " - "template is read from stdin, the value defaults to be " - "the current directory, otherwise it defaults to be the " - "parent directory of the file provided.") + parser.add_argument( + "--var", default=[], action="append", + help="variable (can be used multiple times, use name=value)") + parser.add_argument( + "--template-dir", default=[], action="append", + help="Directory to use for template lookup (multiple " + "directories may be provided). If not given then if the " + "template is read from stdin, the value defaults to be " + "the current directory, otherwise it defaults to be the " + "parent directory of the file provided.") parser.add_argument('input', nargs='?', default='-') options = parser.parse_args(argv) |