MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / cliFormatReply

Function cliFormatReply

src/redis-cli.c:1063–1082  ·  view source on GitHub ↗

Generate reply strings in various output modes */

Source from the content-addressed store, hash-verified

1061
1062/* Generate reply strings in various output modes */
1063static sds cliFormatReply(redisReply *reply, int mode, int verbatim) {
1064 sds out;
1065
1066 if (verbatim) {
1067 out = cliFormatReplyRaw(reply);
1068 } else if (mode == OUTPUT_STANDARD) {
1069 out = cliFormatReplyTTY(reply, "");
1070 } else if (mode == OUTPUT_RAW) {
1071 out = cliFormatReplyRaw(reply);
1072 out = sdscatsds(out, config.cmd_delim);
1073 } else if (mode == OUTPUT_CSV) {
1074 out = cliFormatReplyCSV(reply);
1075 out = sdscatlen(out, "\n", 1);
1076 } else {
1077 fprintf(stderr, "Error: Unknown output encoding %d\n", mode);
1078 exit(1);
1079 }
1080
1081 return out;
1082}
1083
1084/* Output any spontaneous PUSH reply we receive */
1085static void cliPushHandler(void *privdata, void *reply) {

Callers 2

cliPushHandlerFunction · 0.85
cliReadReplyFunction · 0.85

Calls 5

cliFormatReplyRawFunction · 0.85
cliFormatReplyTTYFunction · 0.85
sdscatsdsFunction · 0.85
cliFormatReplyCSVFunction · 0.85
sdscatlenFunction · 0.85

Tested by

no test coverage detected