diff options
author | Binbin <binloveplay1314@qq.com> | 2022-03-28 19:47:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-28 14:47:36 +0300 |
commit | 3f28d7d712329261d0c56df77eef37c88d610cf3 (patch) | |
tree | 22cc68608aa5c583cde52333098099f2a868b858 | |
parent | 63f77698cf3b48b8d3bc1cb18e35fd257bb30fe8 (diff) | |
download | redis-3f28d7d712329261d0c56df77eef37c88d610cf3.tar.gz |
Make redis-cli --cluster help output to stdout (#10485)
redis-cli --cluster help currently outputs the help on stderr.
This is similar to #9124
-rw-r--r-- | src/redis-cli.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c index 0c003a0dc..10b6a9976 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -7323,14 +7323,14 @@ static int clusterManagerCommandHelp(int argc, char **argv) { int commands_count = sizeof(clusterManagerCommands) / sizeof(clusterManagerCommandDef); int i = 0, j; - fprintf(stderr, "Cluster Manager Commands:\n"); + fprintf(stdout, "Cluster Manager Commands:\n"); int padding = 15; for (; i < commands_count; i++) { clusterManagerCommandDef *def = &(clusterManagerCommands[i]); int namelen = strlen(def->name), padlen = padding - namelen; - fprintf(stderr, " %s", def->name); - for (j = 0; j < padlen; j++) fprintf(stderr, " "); - fprintf(stderr, "%s\n", (def->args ? def->args : "")); + fprintf(stdout, " %s", def->name); + for (j = 0; j < padlen; j++) fprintf(stdout, " "); + fprintf(stdout, "%s\n", (def->args ? def->args : "")); if (def->options != NULL) { int optslen = strlen(def->options); char *p = def->options, *eos = p + optslen; @@ -7340,18 +7340,18 @@ static int clusterManagerCommandHelp(int argc, char **argv) { char buf[255]; memcpy(buf, p, deflen); buf[deflen] = '\0'; - for (j = 0; j < padding; j++) fprintf(stderr, " "); - fprintf(stderr, " --cluster-%s\n", buf); + for (j = 0; j < padding; j++) fprintf(stdout, " "); + fprintf(stdout, " --cluster-%s\n", buf); p = comma + 1; if (p >= eos) break; } if (p < eos) { - for (j = 0; j < padding; j++) fprintf(stderr, " "); - fprintf(stderr, " --cluster-%s\n", p); + for (j = 0; j < padding; j++) fprintf(stdout, " "); + fprintf(stdout, " --cluster-%s\n", p); } } } - fprintf(stderr, "\nFor check, fix, reshard, del-node, set-timeout, " + fprintf(stdout, "\nFor check, fix, reshard, del-node, set-timeout, " "info, rebalance, call, import, backup you " "can specify the host and port of any working node in " "the cluster.\n"); @@ -7359,16 +7359,16 @@ static int clusterManagerCommandHelp(int argc, char **argv) { int options_count = sizeof(clusterManagerOptions) / sizeof(clusterManagerOptionDef); i = 0; - fprintf(stderr, "\nCluster Manager Options:\n"); + fprintf(stdout, "\nCluster Manager Options:\n"); for (; i < options_count; i++) { clusterManagerOptionDef *def = &(clusterManagerOptions[i]); int namelen = strlen(def->name), padlen = padding - namelen; - fprintf(stderr, " %s", def->name); - for (j = 0; j < padlen; j++) fprintf(stderr, " "); - fprintf(stderr, "%s\n", def->desc); + fprintf(stdout, " %s", def->name); + for (j = 0; j < padlen; j++) fprintf(stdout, " "); + fprintf(stdout, "%s\n", def->desc); } - fprintf(stderr, "\n"); + fprintf(stdout, "\n"); return 0; } |