From 6e4eae372dca57041586cda5fdfe8294ebfe9f16 Mon Sep 17 00:00:00 2001 From: Conor Scott Date: Tue, 5 Feb 2019 10:46:47 +1030 Subject: [PATCH] [pylightning] add args list to getmanifest [ Shamelessly stolen by Rusty, tweaked parameter name ] --- contrib/pylightning/lightning/plugin.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/contrib/pylightning/lightning/plugin.py b/contrib/pylightning/lightning/plugin.py index 033f1cdfd..2b7a46558 100644 --- a/contrib/pylightning/lightning/plugin.py +++ b/contrib/pylightning/lightning/plugin.py @@ -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 {