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

@@ -18,4 +18,8 @@ plugin.add_option('str_opt', 'i am a string', 'an example string option')
plugin.add_option('int_opt', 7, 'an example int type option', opt_type='int')
plugin.add_option('bool_opt', True, 'an example bool type option', opt_type='bool')
plugin.add_flag_option('flag_opt', 'an example flag type option')
plugin.add_option('str_optm', None, 'an example string option', multi=True)
plugin.add_option('int_optm', 7, 'an example int type option', opt_type='int', multi=True)
plugin.run()