| 520 | } |
| 521 | |
| 522 | static void cliInitHelp(void) { |
| 523 | int commandslen = sizeof(commandHelp)/sizeof(struct commandHelp); |
| 524 | int groupslen = sizeof(commandGroups)/sizeof(char*); |
| 525 | int i, len, pos = 0; |
| 526 | helpEntry tmp; |
| 527 | |
| 528 | helpEntriesLen = len = commandslen+groupslen; |
| 529 | helpEntries = zmalloc(sizeof(helpEntry)*len); |
| 530 | |
| 531 | for (i = 0; i < groupslen; i++) { |
| 532 | tmp.argc = 1; |
| 533 | tmp.argv = zmalloc(sizeof(sds)); |
| 534 | tmp.argv[0] = sdscatprintf(sdsempty(),"@%s",commandGroups[i]); |
| 535 | tmp.full = tmp.argv[0]; |
| 536 | tmp.type = CLI_HELP_GROUP; |
| 537 | tmp.org = NULL; |
| 538 | helpEntries[pos++] = tmp; |
| 539 | } |
| 540 | |
| 541 | for (i = 0; i < commandslen; i++) { |
| 542 | tmp.argv = sdssplitargs(commandHelp[i].name,&tmp.argc); |
| 543 | tmp.full = sdsnew(commandHelp[i].name); |
| 544 | tmp.type = CLI_HELP_COMMAND; |
| 545 | tmp.org = &commandHelp[i]; |
| 546 | helpEntries[pos++] = tmp; |
| 547 | } |
| 548 | } |
| 549 | |
| 550 | /* cliInitHelp() setups the helpEntries array with the command and group |
| 551 | * names from the help.h file. However the Redis instance we are connecting |
no test coverage detected