| 327 | } |
| 328 | |
| 329 | static void cliInitHelp(void) { |
| 330 | int commandslen = sizeof(commandHelp)/sizeof(struct commandHelp); |
| 331 | int groupslen = sizeof(commandGroups)/sizeof(char*); |
| 332 | int i, len, pos = 0; |
| 333 | helpEntry tmp; |
| 334 | |
| 335 | helpEntriesLen = len = commandslen+groupslen; |
| 336 | helpEntries = zmalloc(sizeof(helpEntry)*len, MALLOC_LOCAL); |
| 337 | |
| 338 | for (i = 0; i < groupslen; i++) { |
| 339 | tmp.argc = 1; |
| 340 | tmp.argv = zmalloc(sizeof(sds), MALLOC_LOCAL); |
| 341 | tmp.argv[0] = sdscatprintf(sdsempty(),"@%s",commandGroups[i]); |
| 342 | tmp.full = tmp.argv[0]; |
| 343 | tmp.type = CLI_HELP_GROUP; |
| 344 | tmp.org = NULL; |
| 345 | helpEntries[pos++] = tmp; |
| 346 | } |
| 347 | |
| 348 | for (i = 0; i < commandslen; i++) { |
| 349 | tmp.argv = sdssplitargs(commandHelp[i].name,&tmp.argc); |
| 350 | tmp.full = sdsnew(commandHelp[i].name); |
| 351 | tmp.type = CLI_HELP_COMMAND; |
| 352 | tmp.org = &commandHelp[i]; |
| 353 | helpEntries[pos++] = tmp; |
| 354 | } |
| 355 | } |
| 356 | |
| 357 | /* cliInitHelp() setups the helpEntries array with the command and group |
| 358 | * names from the help.h file. However the Redis instance we are connecting |
no test coverage detected