From 3775a326598f61c4b24767b4303397d80cb08922 Mon Sep 17 00:00:00 2001 From: darosior Date: Sat, 25 May 2019 18:13:24 +0200 Subject: [PATCH] Pylightning: allow to specify the option type at its creation --- contrib/pylightning/lightning/plugin.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/contrib/pylightning/lightning/plugin.py b/contrib/pylightning/lightning/plugin.py index 402f3cccf..c4eaa4641 100644 --- a/contrib/pylightning/lightning/plugin.py +++ b/contrib/pylightning/lightning/plugin.py @@ -187,7 +187,7 @@ class Plugin(object): return f 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. Needs to be called before `Plugin.run`, otherwise we might not @@ -198,11 +198,12 @@ class Plugin(object): raise ValueError( "Name {} is already used by another option".format(name) ) + self.options[name] = { 'name': name, 'default': default, 'description': description, - 'type': 'string', + 'type': opt_type, 'value': None, }