mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-19 15:14:23 +01:00
Pylightning: allow to specify the option type at its creation
This commit is contained in:
@@ -187,7 +187,7 @@ class Plugin(object):
|
|||||||
return f
|
return f
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
def add_option(self, name, default, description):
|
def add_option(self, name, default, description, opt_type="string"):
|
||||||
"""Add an option that we'd like to register with lightningd.
|
"""Add an option that we'd like to register with lightningd.
|
||||||
|
|
||||||
Needs to be called before `Plugin.run`, otherwise we might not
|
Needs to be called before `Plugin.run`, otherwise we might not
|
||||||
@@ -198,11 +198,12 @@ class Plugin(object):
|
|||||||
raise ValueError(
|
raise ValueError(
|
||||||
"Name {} is already used by another option".format(name)
|
"Name {} is already used by another option".format(name)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.options[name] = {
|
self.options[name] = {
|
||||||
'name': name,
|
'name': name,
|
||||||
'default': default,
|
'default': default,
|
||||||
'description': description,
|
'description': description,
|
||||||
'type': 'string',
|
'type': opt_type,
|
||||||
'value': None,
|
'value': None,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user