Add an array of C strings as status replies with a heading. * This function is typically invoked by from commands that support * subcommands in response to the 'help' subcommand. The help array * is terminated by NULL sentinel. */
| 1062 | * subcommands in response to the 'help' subcommand. The help array |
| 1063 | * is terminated by NULL sentinel. */ |
| 1064 | void addReplyHelp(client *c, const char **help) { |
| 1065 | sds cmd = sdsnew((char*) ptrFromObj(c->argv[0])); |
| 1066 | void *blenp = addReplyDeferredLen(c); |
| 1067 | int blen = 0; |
| 1068 | |
| 1069 | sdstoupper(cmd); |
| 1070 | addReplyStatusFormat(c, |
| 1071 | "%s <subcommand> [<arg> [value] [opt] ...]. Subcommands are:",cmd); |
| 1072 | sdsfree(cmd); |
| 1073 | |
| 1074 | while (help[blen]) addReplyStatus(c,help[blen++]); |
| 1075 | |
| 1076 | addReplyStatus(c,"HELP"); |
| 1077 | addReplyStatus(c," Prints this help."); |
| 1078 | |
| 1079 | blen += 1; /* Account for the header. */ |
| 1080 | blen += 2; /* Account for the footer. */ |
| 1081 | setDeferredArrayLen(c,blenp,blen); |
| 1082 | } |
| 1083 | |
| 1084 | /* Add a suggestive error reply. |
| 1085 | * This function is typically invoked by from commands that support |
no test coverage detected