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. */
| 899 | * subcommands in response to the 'help' subcommand. The help array |
| 900 | * is terminated by NULL sentinel. */ |
| 901 | void addReplyHelp(client *c, const char **help) { |
| 902 | sds cmd = sdsnew((char*) c->argv[0]->ptr); |
| 903 | void *blenp = addReplyDeferredLen(c); |
| 904 | int blen = 0; |
| 905 | |
| 906 | sdstoupper(cmd); |
| 907 | addReplyStatusFormat(c, |
| 908 | "%s <subcommand> [<arg> [value] [opt] ...]. Subcommands are:",cmd); |
| 909 | sdsfree(cmd); |
| 910 | |
| 911 | while (help[blen]) addReplyStatus(c,help[blen++]); |
| 912 | |
| 913 | addReplyStatus(c,"HELP"); |
| 914 | addReplyStatus(c," Prints this help."); |
| 915 | |
| 916 | blen += 1; /* Account for the header. */ |
| 917 | blen += 2; /* Account for the footer. */ |
| 918 | setDeferredArrayLen(c,blenp,blen); |
| 919 | } |
| 920 | |
| 921 | /* Add a suggestive error reply. |
| 922 | * This function is typically invoked by from commands that support |
no test coverage detected