adds information attribute to an option
This commit is contained in:
parent
11ad037af9
commit
729feb3239
@ -87,6 +87,7 @@ class Option(BaseType):
|
||||
raise NameError("invalid name: {0} for option".format(name))
|
||||
self._name = name
|
||||
self.doc = doc
|
||||
self.informations = {}
|
||||
self._requires = requires
|
||||
self._mandatory = mandatory
|
||||
self.multi = multi
|
||||
@ -194,6 +195,25 @@ class Option(BaseType):
|
||||
"accesses the Option's doc"
|
||||
return self.doc
|
||||
|
||||
def set_information(self, key, value):
|
||||
"""updates the information's attribute
|
||||
(wich is a dictionnary)
|
||||
|
||||
:param key: information's key (ex: "help", "doc"
|
||||
:param value: information's value (ex: "the help string")
|
||||
"""
|
||||
self.informations[key] = value
|
||||
|
||||
def get_information(self, key):
|
||||
"""retrieves one information's item
|
||||
|
||||
:param key: the item string (ex: "help")
|
||||
"""
|
||||
if key in self.informations:
|
||||
return self.informations[key]
|
||||
else:
|
||||
raise ValueError("Information's item not found: {0}".format(key))
|
||||
|
||||
def getcallback(self):
|
||||
"a callback is only a link, the name of an external hook"
|
||||
return self.callback
|
||||
|
Loading…
Reference in New Issue
Block a user