From 8ba59f06055586a4d79c59602287e347c68566ce Mon Sep 17 00:00:00 2001 From: Mike Hiretsky Date: Fri, 15 Oct 2010 09:41:19 +0400 Subject: [PATCH] Add ability change variables in cl-template. --- pym/cl_apply_template_cmd.py | 8 +++----- scripts/cl-template | 3 +++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pym/cl_apply_template_cmd.py b/pym/cl_apply_template_cmd.py index 7c89510..50084af 100644 --- a/pym/cl_apply_template_cmd.py +++ b/pym/cl_apply_template_cmd.py @@ -39,10 +39,7 @@ CMD_OPTIONS = [{'shortOption':"l", 'all','clt','local','remote'")}, {'longOption':"clt", 'optVal':"CLT_TEMPLATE", - 'help':_("process clt template (default)")}, - {'shortOption':"v", - 'longOption':"vars", - 'help':_("print variables") + 'help':_("process clt template (default)") }] class apply_template_cmd(share_cmd): @@ -55,7 +52,7 @@ class apply_template_cmd(share_cmd): examples=EXAMPLES, comment_examples=COMMENT_EXAMPLES, description=DESCRIPTION, - option_list=CMD_OPTIONS + opt.color_control, + option_list=CMD_OPTIONS + opt.color_control + opt.variable_control, check_values=self.checkOpts) # Создаем объект логики self.logicObj = updateConfFiles() @@ -82,6 +79,7 @@ class apply_template_cmd(share_cmd): errMsg = _("incorrect arguments") + ":" + " %s" %" ".join(args) self.optobj.error(errMsg) return False + self.optobj.checkVarSyntax(optObj) return optObj, args def applyCltTemplate(self, cltTemplate): diff --git a/scripts/cl-template b/scripts/cl-template index 4c7e86d..a614431 100644 --- a/scripts/cl-template +++ b/scripts/cl-template @@ -35,6 +35,9 @@ if __name__ == "__main__": options, args = ret # set color/nocolor for display messages obj.setPrintNoColor(options) + # set values to variables + if not obj.setVars(options): + sys.exit(1) # Печать переменных if options.v: obj.printVars(options)