Merge pull request #1192 from badboy/ipv6-rediscli

Wrap IPv6 in brackets in the prompt.
This commit is contained in:
Salvatore Sanfilippo 2013-07-12 01:55:09 -07:00
commit 2ed64e1f7a

View File

@ -116,7 +116,8 @@ static void cliRefreshPrompt(void) {
len = snprintf(config.prompt,sizeof(config.prompt),"redis %s",
config.hostsocket);
else
len = snprintf(config.prompt,sizeof(config.prompt),"redis %s:%d",
len = snprintf(config.prompt,sizeof(config.prompt),
strchr(config.hostip,':') ? "[%s]:%d" : "%s:%d",
config.hostip, config.hostport);
/* Add [dbnum] if needed */
if (config.dbnum != 0)