2020-03-08 01:15:37 +01:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
"""This plugin is used to check that plugin options are parsed properly.
|
|
|
|
|
|
|
|
The plugin offers 3 options, one of each supported type.
|
|
|
|
"""
|
2020-02-11 23:04:21 +01:00
|
|
|
from pyln.client import Plugin
|
2020-03-08 01:15:37 +01:00
|
|
|
|
|
|
|
plugin = Plugin()
|
|
|
|
|
|
|
|
|
|
|
|
@plugin.init()
|
|
|
|
def init(configuration, options, plugin):
|
|
|
|
for name, val in options.items():
|
|
|
|
plugin.log("option {} {} {}".format(name, val, type(val)))
|
|
|
|
|
|
|
|
|
|
|
|
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')
|
2020-03-17 02:34:35 +01:00
|
|
|
plugin.add_flag_option('flag_opt', 'an example flag type option')
|
2020-12-14 05:52:23 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
|
2022-06-15 09:26:21 +02:00
|
|
|
plugin.add_option('greeting', 7, 'option _names_ should be unique', opt_type='int', multi=True)
|
|
|
|
|
2020-03-08 01:15:37 +01:00
|
|
|
plugin.run()
|