size_t *argvlen;
int j;
+ if (context == NULL) {
+ printf("Not connected, please use: connect <host> <port>\n");
+ return REDIS_OK;
+ }
+
config.raw_output = !strcasecmp(command,"info");
- if (!strcasecmp(command,"help")) {
- showInteractiveHelp();
+ if (!strcasecmp(command,"help") || !strcasecmp(command,"?")) {
+ cliOutputHelp(--argc, ++argv);
return REDIS_OK;
}
if (!strcasecmp(command,"shutdown")) config.shutdown = 1;
sds *argv;
config.interactive = 1;
- while((line = linenoise("redis> ")) != NULL) {
+ linenoiseSetCompletionCallback(completionCallback);
++
+ while((line = linenoise(context ? "redis> " : "not connected> ")) != NULL) {
if (line[0] != '\0') {
argv = sdssplitargs(line,&argc);
linenoiseHistoryAdd(line);