| 444 | } |
| 445 | |
| 446 | static enum format choose_format(const char *resp, |
| 447 | jsmntok_t **toks, |
| 448 | const char *method, |
| 449 | const char *command, |
| 450 | enum format format) |
| 451 | { |
| 452 | /* If they specify a format, that's what we use. */ |
| 453 | if (format != DEFAULT_FORMAT) { |
| 454 | /* But humans don't want to see the format hint! */ |
| 455 | if (format == HUMAN) |
| 456 | delete_format_hint(resp, toks); |
| 457 | return format; |
| 458 | } |
| 459 | |
| 460 | /* This works best when we order it. */ |
| 461 | if (streq(method, "help") && command == NULL) |
| 462 | format = HELPLIST; |
| 463 | else |
| 464 | format = delete_format_hint(resp, toks); |
| 465 | |
| 466 | return format; |
| 467 | } |
| 468 | |
| 469 | static bool handle_notify(const char *buf, jsmntok_t *toks, |
| 470 | enum log_level notification_level, |
no test coverage detected