libplugin.c: Handle command categories then set them in pay and autoclean

This commit is contained in:
darosior
2019-05-22 16:27:34 +02:00
committed by Rusty Russell
parent 5b0bf0ba1f
commit 9d34121ec5
4 changed files with 10 additions and 3 deletions

View File

@@ -71,6 +71,7 @@ static void init(struct plugin_conn *prpc)
static const struct plugin_command commands[] = { { static const struct plugin_command commands[] = { {
"autocleaninvoice", "autocleaninvoice",
"payment",
"Set up autoclean of expired invoices. ", "Set up autoclean of expired invoices. ",
"Perform cleanup every {cycle_seconds} (default 3600), or disable autoclean if 0. " "Perform cleanup every {cycle_seconds} (default 3600), or disable autoclean if 0. "
"Clean up expired invoices that have expired for {expired_by} seconds (default 86400). ", "Clean up expired invoices that have expired for {expired_by} seconds (default 86400). ",

View File

@@ -452,9 +452,11 @@ handle_getmanifest(struct command *getmanifest_cmd,
for (size_t i = 0; i < num_commands; i++) { for (size_t i = 0; i < num_commands; i++) {
tal_append_fmt(&params, "{ 'name': '%s'," tal_append_fmt(&params, "{ 'name': '%s',"
" 'category': '%s',"
" 'usage': '%s'," " 'usage': '%s',"
" 'description': '%s'", " 'description': '%s'",
commands[i].name, commands[i].name,
commands[i].category,
strmap_get(&usagemap, commands[i].name), strmap_get(&usagemap, commands[i].name),
commands[i].description); commands[i].description);
if (commands[i].long_description) if (commands[i].long_description)

View File

@@ -18,6 +18,7 @@ extern bool deprecated_apis;
/* Create an array of these, one for each command you support. */ /* Create an array of these, one for each command you support. */
struct plugin_command { struct plugin_command {
const char *name; const char *name;
const char *category;
const char *description; const char *description;
const char *long_description; const char *long_description;
struct command_result *(*handle)(struct command *cmd, struct command_result *(*handle)(struct command *cmd,

View File

@@ -1225,16 +1225,19 @@ static void init(struct plugin_conn *rpc)
static const struct plugin_command commands[] = { { static const struct plugin_command commands[] = { {
"pay", "pay",
"payment",
"Send payment specified by {bolt11} with {amount}", "Send payment specified by {bolt11} with {amount}",
"Try to send a payment, retrying {retry_for} seconds before giving up", "Try to send a payment, retrying {retry_for} seconds before giving up",
json_pay json_pay
}, { }, {
"paystatus", "paystatus",
"payment",
"Detail status of attempts to pay {bolt11}, or all", "Detail status of attempts to pay {bolt11}, or all",
"Covers both old payments and current ones.", "Covers both old payments and current ones.",
json_paystatus json_paystatus
}, { }, {
"listpays", "listpays",
"payment",
"List result of payment {bolt11}, or all", "List result of payment {bolt11}, or all",
"Covers old payments (failed and succeeded) and current ones.", "Covers old payments (failed and succeeded) and current ones.",
json_listpays json_listpays