cli: help command now also prints usage

The help command now adds command usage to its output by calling each
command handler in CMD_USAGE mode.

Instead of seeing, for example:

	decodepay
	    Decode {bolt11}, using {description} if necessary

we see:

	decodepay bolt11 [description]
	    Decode {bolt11}, using {description} if necessary

Signed-off-by: Mark Beckwith <wythe@intrig.com>
This commit is contained in:
Mark Beckwith
2018-09-13 10:57:24 -05:00
committed by Christian Decker
parent 1a4f355a7b
commit cbde3e20f7
3 changed files with 13 additions and 5 deletions

View File

@@ -244,7 +244,7 @@ static bool param_arr(struct command *cmd, const char *buffer,
{
#if DEVELOPER
if (!check_params(params)) {
command_fail(cmd, PARAM_DEV_ERROR, "developer error");
command_fail(cmd, PARAM_DEV_ERROR, "developer error: check_params");
return false;
}
#endif
@@ -271,7 +271,8 @@ bool param(struct command *cmd, const char *buffer,
param_cbx cbx = va_arg(ap, param_cbx);
void *arg = va_arg(ap, void *);
if (!param_add(&params, name, required, cbx, arg)) {
command_fail(cmd, PARAM_DEV_ERROR, "developer error");
command_fail(cmd, PARAM_DEV_ERROR,
"developer error: param_add %s", name);
va_end(ap);
return false;
}