jp: renamed “params” command to “param” for consistency with other commands + added a “get” subcommand
This commit is contained in:
parent
810a40c51c
commit
410c0ce462
1 changed files with 24 additions and 4 deletions
|
|
@ -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'))
|
||||
Loading…
Reference in a new issue