From 4eb3b3e970506152b0977c2c73c0aad5b97148f6 Mon Sep 17 00:00:00 2001
From: antirez <antirez@gmail.com>
Date: Wed, 22 Feb 2012 15:16:11 +0100
Subject: [PATCH] Redis-cli should accept help command even if there is no
 connection to the server.

---
 src/redis-cli.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/redis-cli.c b/src/redis-cli.c
index 3f60a132..692736c7 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -501,6 +501,11 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
     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;
@@ -515,10 +520,6 @@ static int cliSendCommand(int argc, char **argv, int repeat) {
         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") ||
-- 
2.47.2