comparison frontends/src/jp/cmd_param.py @ 1594:313f2bb7841b

jp: profile session can now be started without connection: - a new need_connect option is used when during BaseCommand init - if need_connect is True, profile connection is necessary, so use_profile must be True too - if need_connect if False, session can be started without connection, use_profile must be True - if need_connect is None, use_profile can be True (need_connect will be set to True) or False (need_connect is not used) - if need_connect is False (and so use_profile is True), a new --start-session option is usable - param get and set are the first commands to use this option, so parameters can be changed if connection is not working
author Goffi <goffi@goffi.org>
date Sat, 14 Nov 2015 19:18:10 +0100
parents 791c45ed8659
children d17772b0fe22
comparison
equal deleted inserted replaced
1593:791c45ed8659 1594:313f2bb7841b
24 __commands__ = ["Param"] 24 __commands__ = ["Param"]
25 25
26 26
27 class Get(base.CommandBase): 27 class Get(base.CommandBase):
28 def __init__(self, host): 28 def __init__(self, host):
29 super(Get, self).__init__(host, 'get', help=_('Get a parameter value')) 29 super(Get, self).__init__(host, 'get', need_connect=False, help=_('Get a parameter value'))
30 30
31 def add_parser_options(self): 31 def add_parser_options(self):
32 self.parser.add_argument("category", nargs='?', type=base.unicode_decoder, help=_(u"Category of the parameter")) 32 self.parser.add_argument("category", nargs='?', type=base.unicode_decoder, help=_(u"Category of the parameter"))
33 self.parser.add_argument("name", nargs='?', type=base.unicode_decoder, help=_(u"Name of the parameter")) 33 self.parser.add_argument("name", nargs='?', type=base.unicode_decoder, help=_(u"Name of the parameter"))
34 self.parser.add_argument("-a", "--attribute", type=str, default="value", help=_(u"Name of the attribute to get")) 34 self.parser.add_argument("-a", "--attribute", type=str, default="value", help=_(u"Name of the attribute to get"))
57 print value 57 print value
58 58
59 59
60 class Set(base.CommandBase): 60 class Set(base.CommandBase):
61 def __init__(self, host): 61 def __init__(self, host):
62 super(Set, self).__init__(host, 'set', help=_('Set a parameter value')) 62 super(Set, self).__init__(host, 'set', need_connect=False, help=_('Set a parameter value'))
63 63
64 def add_parser_options(self): 64 def add_parser_options(self):
65 self.parser.add_argument("category", type=base.unicode_decoder, help=_(u"Category of the parameter")) 65 self.parser.add_argument("category", type=base.unicode_decoder, help=_(u"Category of the parameter"))
66 self.parser.add_argument("name", type=base.unicode_decoder, help=_(u"Name of the parameter")) 66 self.parser.add_argument("name", type=base.unicode_decoder, help=_(u"Name of the parameter"))
67 self.parser.add_argument("value", type=base.unicode_decoder, help=_(u"Name of the parameter")) 67 self.parser.add_argument("value", type=base.unicode_decoder, help=_(u"Name of the parameter"))