diff options
author | Jan-Erik Rediger <badboy@archlinux.us> | 2013-07-11 17:47:55 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2013-07-12 10:58:47 +0200 |
commit | 1bcbb7a90c7a32da41fa9430f1c20c46ba77e43d (patch) | |
tree | 0284ac17b8a43b67637a8ae51121aa9f113e97b6 | |
parent | 1e23848ed357f68bfb3dc60937f605cd147cb5f2 (diff) | |
download | redis-1bcbb7a90c7a32da41fa9430f1c20c46ba77e43d.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 c9eba1b59..f14b47882 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) |