diff options
-rw-r--r-- | cli/src/cli.c | 16 | ||||
-rw-r--r-- | cli/src/cli.h | 4 |
2 files changed, 15 insertions, 5 deletions
diff --git a/cli/src/cli.c b/cli/src/cli.c index 9b1ed87c1e7..511b45b54ef 100644 --- a/cli/src/cli.c +++ b/cli/src/cli.c @@ -396,10 +396,11 @@ cli_opt_parse (char *opt, struct cli_state *state) int parse_cmdline (int argc, char *argv[], struct cli_state *state) { - int ret = 0; - int i = 0; - int j = 0; - char *opt = NULL; + int ret = 0; + int i = 0; + int j = 0; + char *opt = NULL; + gf_boolean_t geo_rep_config = _gf_false; state->argc=argc-1; state->argv=&argv[1]; @@ -409,9 +410,14 @@ parse_cmdline (int argc, char *argv[], struct cli_state *state) state->ctx->secure_mgmt = 1; } + if (state->argc >= GEO_REP_CMD_CONFIG_INDEX && + strtail (state->argv[GEO_REP_CMD_INDEX], "geo") && + strtail (state->argv[GEO_REP_CMD_CONFIG_INDEX], "co")) + geo_rep_config = _gf_true; + for (i = 0; i < state->argc; i++) { opt = strtail (state->argv[i], "--"); - if (opt) { + if (opt && !geo_rep_config) { ret = cli_opt_parse (opt, state); if (ret == -1) { cli_out ("unrecognized option --%s", opt); diff --git a/cli/src/cli.h b/cli/src/cli.h index 60bbcb9f620..2648d25ee9c 100644 --- a/cli/src/cli.h +++ b/cli/src/cli.h @@ -38,6 +38,10 @@ #define CLI_TAB_LENGTH 8 #define CLI_BRICK_STATUS_LINE_LEN 78 +/* Geo-rep command positional arguments' index */ +#define GEO_REP_CMD_INDEX 1 +#define GEO_REP_CMD_CONFIG_INDEX 4 + enum argp_option_keys { ARGP_DEBUG_KEY = 133, ARGP_PORT_KEY = 'p', |