diff options
author | Jan-Erik Rediger <badboy@archlinux.us> | 2013-07-11 17:47:55 +0200 |
---|---|---|
committer | Jan-Erik Rediger <badboy@archlinux.us> | 2013-07-11 17:47:55 +0200 |
commit | 1b696dc07ce137c4e5bfc7c7e35e0f9b751099fc (patch) | |
tree | 2e1c36bf6dedd7f8538dedf04bccebd9a17c2441 | |
parent | 73ae8558c17a486a694f49dede5a6febed99e9e5 (diff) | |
download | redis-1b696dc07ce137c4e5bfc7c7e35e0f9b751099fc.tar.gz |
Wrap IPv6 in brackets in the prompt.
-rw-r--r-- | src/redis-cli.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index d52076f0b..b4ce644f7 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) |