| 33 | }; |
| 34 | |
| 35 | static struct command_result *param_mode(struct command *cmd, |
| 36 | const char *name, |
| 37 | const char *buffer, |
| 38 | const jsmntok_t *tok, |
| 39 | enum ds_mode **mode) |
| 40 | { |
| 41 | *mode = tal(cmd, enum ds_mode); |
| 42 | if (json_tok_streq(buffer, tok, "must-create")) |
| 43 | **mode = DS_MUST_NOT_EXIST; |
| 44 | else if (json_tok_streq(buffer, tok, "must-replace")) |
| 45 | **mode = DS_MUST_EXIST; |
| 46 | else if (json_tok_streq(buffer, tok, "create-or-replace")) |
| 47 | **mode = 0; |
| 48 | else if (json_tok_streq(buffer, tok, "must-append")) |
| 49 | **mode = DS_MUST_EXIST | DS_APPEND; |
| 50 | else if (json_tok_streq(buffer, tok, "create-or-append")) |
| 51 | **mode = DS_APPEND; |
| 52 | else |
| 53 | return command_fail_badparam(cmd, name, buffer, tok, |
| 54 | "should be 'must-create'," |
| 55 | " 'must-replace'," |
| 56 | " 'create-or-replace'," |
| 57 | " 'must-append'," |
| 58 | " or 'create-or-append'"); |
| 59 | |
| 60 | return NULL; |
| 61 | } |
| 62 | |
| 63 | static struct command_result *param_list_or_string(struct command *cmd, |
| 64 | const char *name, |
nothing calls this directly
no test coverage detected