[pylightning] add args list to getmanifest

[ Shamelessly stolen by Rusty, tweaked parameter name ]
This commit is contained in:
Conor Scott 2019-02-05 10:46:47 +10:30 committed by Rusty Russell
parent 0c89fc5d70
commit 6e4eae372d

View File

@ -306,9 +306,20 @@ class Plugin(object):
doc = "Undocumented RPC method from a plugin."
doc = re.sub('\n+', ' ', doc)
argspec = inspect.getargspec(func)
args = argspec.args[1:]
defaults = argspec.defaults
# Make optional args be surrounded by square brackets
# list regular lightning-cli commands args
if defaults:
for idx in range(-len(defaults), 0):
args[idx] = '[' + args[idx] + ']'
methods.append({
'name': name,
'description': doc,
'usage': " ".join(args),
'description': doc
})
return {