From 1b696dc07ce137c4e5bfc7c7e35e0f9b751099fc Mon Sep 17 00:00:00 2001 From: Jan-Erik Rediger Date: Thu, 11 Jul 2013 17:47:55 +0200 Subject: [PATCH] Wrap IPv6 in brackets in the prompt. --- src/redis-cli.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/redis-cli.c b/src/redis-cli.c index d52076f0..b4ce644f 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -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)