char *auth;
int raw_output; /* output mode per command */
sds mb_delim;
- char prompt[32];
+ char prompt[128];
char *eval;
} config;
}
static void cliRefreshPrompt(void) {
- if (config.dbnum == 0)
- snprintf(config.prompt,sizeof(config.prompt),"redis %s:%d> ",
- config.hostip, config.hostport);
+ int len;
+
+ if (config.hostsocket != NULL)
+ len = snprintf(config.prompt,sizeof(config.prompt),"redis %s",
+ config.hostsocket);
else
- snprintf(config.prompt,sizeof(config.prompt),"redis %s:%d[%d]> ",
- config.hostip, config.hostport, config.dbnum);
+ len = snprintf(config.prompt,sizeof(config.prompt),"redis %s:%d",
+ config.hostip, config.hostport);
+ /* Add [dbnum] if needed */
+ if (config.dbnum != 0)
+ len += snprintf(config.prompt+len,sizeof(config.prompt)-len,"[%d]",
+ config.dbnum);
+ snprintf(config.prompt+len,sizeof(config.prompt)-len,"> ");
}
/*------------------------------------------------------------------------------
size_t *argvlen;
int j, output_raw;
+ if (!strcasecmp(command,"help") || !strcasecmp(command,"?")) {
+ cliOutputHelp(--argc, ++argv);
+ return REDIS_OK;
+ }
+
if (context == NULL) return REDIS_ERR;
output_raw = 0;
output_raw = 1;
}
- if (!strcasecmp(command,"help") || !strcasecmp(command,"?")) {
- cliOutputHelp(--argc, ++argv);
- return REDIS_OK;
- }
if (!strcasecmp(command,"shutdown")) config.shutdown = 1;
if (!strcasecmp(command,"monitor")) config.monitor_mode = 1;
if (!strcasecmp(command,"subscribe") ||