MCPcopy Create free account
hub / github.com/F-Stack/f-stack / cliSendCommand

Function cliSendCommand

app/redis-6.2.6/src/redis-cli.c:1372–1524  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1370}
1371
1372static int cliSendCommand(int argc, char **argv, long repeat) {
1373 char *command = argv[0];
1374 size_t *argvlen;
1375 int j, output_raw;
1376
1377 if (!config.eval_ldb && /* In debugging mode, let's pass "help" to Redis. */
1378 (!strcasecmp(command,"help") || !strcasecmp(command,"?"))) {
1379 cliOutputHelp(--argc, ++argv);
1380 return REDIS_OK;
1381 }
1382
1383 if (context == NULL) return REDIS_ERR;
1384
1385 output_raw = 0;
1386 if (!strcasecmp(command,"info") ||
1387 !strcasecmp(command,"lolwut") ||
1388 (argc >= 2 && !strcasecmp(command,"debug") &&
1389 !strcasecmp(argv[1],"htstats")) ||
1390 (argc >= 2 && !strcasecmp(command,"debug") &&
1391 !strcasecmp(argv[1],"htstats-key")) ||
1392 (argc >= 2 && !strcasecmp(command,"memory") &&
1393 (!strcasecmp(argv[1],"malloc-stats") ||
1394 !strcasecmp(argv[1],"doctor"))) ||
1395 (argc == 2 && !strcasecmp(command,"cluster") &&
1396 (!strcasecmp(argv[1],"nodes") ||
1397 !strcasecmp(argv[1],"info"))) ||
1398 (argc >= 2 && !strcasecmp(command,"client") &&
1399 (!strcasecmp(argv[1],"list") ||
1400 !strcasecmp(argv[1],"info"))) ||
1401 (argc == 3 && !strcasecmp(command,"latency") &&
1402 !strcasecmp(argv[1],"graph")) ||
1403 (argc == 2 && !strcasecmp(command,"latency") &&
1404 !strcasecmp(argv[1],"doctor")) ||
1405 /* Format PROXY INFO command for Redis Cluster Proxy:
1406 * https://github.com/artix75/redis-cluster-proxy */
1407 (argc >= 2 && !strcasecmp(command,"proxy") &&
1408 !strcasecmp(argv[1],"info")))
1409 {
1410 output_raw = 1;
1411 }
1412
1413 if (!strcasecmp(command,"shutdown")) config.shutdown = 1;
1414 if (!strcasecmp(command,"monitor")) config.monitor_mode = 1;
1415 if (!strcasecmp(command,"subscribe") ||
1416 !strcasecmp(command,"psubscribe")) config.pubsub_mode = 1;
1417 if (!strcasecmp(command,"sync") ||
1418 !strcasecmp(command,"psync")) config.slave_mode = 1;
1419
1420 /* When the user manually calls SCRIPT DEBUG, setup the activation of
1421 * debugging mode on the next eval if needed. */
1422 if (argc == 3 && !strcasecmp(argv[0],"script") &&
1423 !strcasecmp(argv[1],"debug"))
1424 {
1425 if (!strcasecmp(argv[2],"yes") || !strcasecmp(argv[2],"sync")) {
1426 config.enable_ldb_on_eval = 1;
1427 } else {
1428 config.enable_ldb_on_eval = 0;
1429 }

Callers 1

issueCommandRepeatFunction · 0.85

Calls 12

strcasecmpFunction · 0.85
cliOutputHelpFunction · 0.85
zmallocFunction · 0.85
sdslenFunction · 0.85
redisAppendCommandArgvFunction · 0.85
cliReadReplyFunction · 0.85
redisSetPushCallbackFunction · 0.85
slaveModeFunction · 0.85
cliRefreshPromptFunction · 0.85
cliSelectFunction · 0.85
zfreeFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected