Used as a strmap_iterate function: returns true to continue */
| 423 | |
| 424 | /* Used as a strmap_iterate function: returns true to continue */ |
| 425 | static bool json_add_help_command(const char *cmdname, |
| 426 | struct cmd_and_usage *cmd, |
| 427 | struct json_help_info *hinfo) |
| 428 | { |
| 429 | char *usage; |
| 430 | |
| 431 | /* If they disallow deprecated APIs, don't even list them */ |
| 432 | if (!command_deprecated_out_ok(hinfo->cmd, NULL, |
| 433 | cmd->command->depr_start, |
| 434 | cmd->command->depr_end)) { |
| 435 | return true; |
| 436 | } |
| 437 | |
| 438 | usage = tal_fmt(tmpctx, "%s%s %s", |
| 439 | cmd->command->name, |
| 440 | cmd->command->depr_start ? " (DEPRECATED!)" : "", |
| 441 | cmd->usage); |
| 442 | json_object_start(hinfo->response, NULL); |
| 443 | json_add_string(hinfo->response, "command", usage); |
| 444 | json_object_end(hinfo->response); |
| 445 | return true; |
| 446 | } |
| 447 | |
| 448 | static struct command_result *json_help(struct command *cmd, |
| 449 | const char *buffer, |
no test coverage detected