From 9e25aad3d172117aeaeb8a4f6513a85a1cfbd971 Mon Sep 17 00:00:00 2001 From: Simon Vrouwe Date: Tue, 30 Jul 2019 11:44:10 +0300 Subject: [PATCH] helpme: Wrap response in `simple` format-hint, so lightning-cli prints it as -H --- helpme/helpme.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/helpme/helpme.py b/helpme/helpme.py index 7d90426..d502a6f 100755 --- a/helpme/helpme.py +++ b/helpme/helpme.py @@ -1,6 +1,7 @@ #! /usr/bin/env python3 from lightning import Plugin, Millisatoshi, RpcError from collections import defaultdict +from functools import wraps from os import path import random import threading @@ -896,7 +897,16 @@ Rusty Russell, Senior Code Monkey.""" +# Format hint `simple` makes lightning-cli print it as (-H) human readable +def format_simple(fn): + @wraps(fn) + def wrapped(*args, **kwargs): + return {'text': fn(*args, **kwargs), 'format-hint': 'simple'} + return wrapped + + @plugin.method("helpme") +@format_simple def helpme(plugin, command=None, *args): """Gives helpful hints about running this node."""