summaryrefslogtreecommitdiff
path: root/src/redis-cli.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2019-03-12 17:25:57 +0100
committerGitHub <noreply@github.com>2019-03-12 17:25:57 +0100
commit0e91093902f516988d53d5eb6a7f7cc4cc16d8ba (patch)
treea372e9fb4a4401a623aa15aa7b03c244f9836bc0 /src/redis-cli.c
parent67452e9136d1f132db8e2e678a44d75103dd8382 (diff)
parentbc6c1c40db038a5c313aaa76f2feebce8b65afd2 (diff)
downloadredis-0e91093902f516988d53d5eb6a7f7cc4cc16d8ba.tar.gz
Merge pull request #5879 from meierfra-ergon/redis-cli-assume-yes
added 'assume-yes' option to redis-cli
Diffstat (limited to 'src/redis-cli.c')
-rw-r--r--src/redis-cli.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/redis-cli.c b/src/redis-cli.c
index 2af262818..1bd419688 100644
--- a/src/redis-cli.c
+++ b/src/redis-cli.c
@@ -68,6 +68,7 @@
#define REDIS_CLI_RCFILE_ENV "REDISCLI_RCFILE"
#define REDIS_CLI_RCFILE_DEFAULT ".redisclirc"
#define REDIS_CLI_AUTH_ENV "REDISCLI_AUTH"
+#define REDIS_CLI_CLUSTER_YES_ENV "REDISCLI_CLUSTER_YES"
#define CLUSTER_MANAGER_SLOTS 16384
#define CLUSTER_MANAGER_MIGRATE_TIMEOUT 60000
@@ -1438,6 +1439,11 @@ static void parseEnv() {
if (auth != NULL && config.auth == NULL) {
config.auth = auth;
}
+
+ char *cluster_yes = getenv(REDIS_CLI_CLUSTER_YES_ENV);
+ if (cluster_yes != NULL && !strcmp(cluster_yes, "1")) {
+ config.cluster_manager_command.flags |= CLUSTER_MANAGER_CMD_FLAG_YES;
+ }
}
static sds readArgFromStdin(void) {
@@ -1549,6 +1555,9 @@ static void usage(void) {
}
static int confirmWithYes(char *msg) {
+ if (config.cluster_manager_command.flags & CLUSTER_MANAGER_CMD_FLAG_YES) {
+ return 1;
+ }
printf("%s (type 'yes' to accept): ", msg);
fflush(stdout);
char buf[4];