diff --git a/frontends/src/jp/cmd_params.py b/frontends/src/jp/cmd_param.py similarity index 63% rename from frontends/src/jp/cmd_params.py rename to frontends/src/jp/cmd_param.py index cf1ee9c7..ea3723b5 100644 --- a/frontends/src/jp/cmd_params.py +++ b/frontends/src/jp/cmd_param.py @@ -21,8 +21,28 @@ import base from sat.core.i18n import _ +__commands__ = ["Param"] -__commands__ = ["Params"] + +class Get(base.CommandBase): + def __init__(self, host): + super(Get, self).__init__(host, 'get', help=_('Get a parameter value')) + + def add_parser_options(self): + self.parser.add_argument("category", type=base.unicode_decoder, help=_(u"Category of the parameter")) + self.parser.add_argument("name", type=base.unicode_decoder, help=_(u"Name of the parameter")) + self.parser.add_argument("-a", "--attribute", type=str, default="value", help=_(u"Name of the attribute to get")) + self.parser.add_argument("--security-limit", type=int, default=-1, help=_(u"Security limit")) + + def connected(self): + super(Get, self).connected() + try: + value = self.host.bridge.asyncGetParamA(self.args.name, self.args.category, self.args.attribute, + self.args.security_limit, self.profile) + except Exception: + print u"Can't find requested parameter" + self.host.quit(1) + print value class SaveTemplate(base.CommandBase): @@ -56,8 +76,8 @@ class LoadTemplate(base.CommandBase): print _("Can't load parameters from file %s") % self.args.filename -class Params(base.CommandBase): - subcommands = (SaveTemplate, LoadTemplate) +class Param(base.CommandBase): + subcommands = (Get, SaveTemplate, LoadTemplate) def __init__(self, host): - super(Params, self).__init__(host, 'params', use_profile=False, help=_('Save/load parameters template')) + super(Param, self).__init__(host, 'param', use_profile=False, help=_('Save/load parameters template'))