From d95ea51a737849cc232248739c5c0aaf3d9b7232 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 6 Apr 2022 11:24:09 +0930 Subject: [PATCH] lightning-cli: document the real argument handling (for special effects). And fix it to pass through decimals like the man page promises! Signed-off-by: Rusty Russell --- cli/lightning-cli.c | 2 +- doc/lightning-cli.1.md | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/lightning-cli.c b/cli/lightning-cli.c index 06e47f2b8..ede08a6b4 100644 --- a/cli/lightning-cli.c +++ b/cli/lightning-cli.c @@ -276,7 +276,7 @@ static bool is_literal(const char *arg) if (arglen == 0) { return false; } - return strspn(arg, "0123456789") == arglen + return strspn(arg, "0123456789.") == arglen || streq(arg, "true") || streq(arg, "false") || streq(arg, "null") diff --git a/doc/lightning-cli.1.md b/doc/lightning-cli.1.md index 254616c1d..263340bbe 100644 --- a/doc/lightning-cli.1.md +++ b/doc/lightning-cli.1.md @@ -89,7 +89,8 @@ this is to avoid having lightningd intrepret the position of an arguement. Arguments may be integer numbers (composed entirely of digits), floating-point numbers (has a radix point but otherwise composed of digits), *true*, *false*, -or *null*. Other arguments are treated as strings. +or *null*. Arguments which begin with *{*, *[* or *"* are also considered +raw JSON and are passed through. Other arguments are treated as strings. Some commands have optional arguments. You may use *null* to skip optional arguments to provide later arguments, although this is not encouraged.