plugins: support concatenation of multiple args.

"multi" means that specifying a parameter twice will append, not override.
Multi args are always given as a JSON array, even if only one.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: Plugins: new "multi" field allows an option to be specified multiple times.
This commit is contained in:
Rusty Russell
2020-12-14 15:22:23 +10:30
parent 646c564ec5
commit 8a9976c4c1
6 changed files with 170 additions and 81 deletions

View File

@@ -326,7 +326,8 @@ class Plugin(object):
def add_option(self, name: str, default: Optional[str],
description: Optional[str],
opt_type: str = "string", deprecated: bool = False) -> None:
opt_type: str = "string", deprecated: bool = False,
multi: bool = False) -> None:
"""Add an option that we'd like to register with lightningd.
Needs to be called before `Plugin.run`, otherwise we might not
@@ -349,6 +350,7 @@ class Plugin(object):
'description': description,
'type': opt_type,
'value': None,
'multi': multi,
'deprecated': deprecated,
}