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

Function cliRefreshPrompt

src/redis-cli.c:130–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130static void cliRefreshPrompt(void) {
131 if (config.eval_ldb) return;
132
133 sds prompt = sdsempty();
134 if (config.hostsocket != NULL) {
135 prompt = sdscatfmt(prompt,"redis %s",config.hostsocket);
136 } else {
137 char addr[256];
138 anetFormatAddr(addr, sizeof(addr), config.hostip, config.hostport);
139 prompt = sdscatlen(prompt,addr,strlen(addr));
140 }
141
142 /* Add [dbnum] if needed */
143 if (config.dbnum != 0)
144 prompt = sdscatfmt(prompt,"[%i]",config.dbnum);
145
146 /* Add TX if in transaction state*/
147 if (config.in_multi)
148 prompt = sdscatlen(prompt,"(TX)",4);
149
150 /* Copy the prompt in the static buffer. */
151 prompt = sdscatlen(prompt,"> ",2);
152 snprintf(config.prompt,sizeof(config.prompt),"%s",prompt);
153 sdsfree(prompt);
154}
155
156struct dictEntry;
157void asyncFreeDictTable(struct dictEntry **de) {

Callers 6

cliSelectFunction · 0.85
cliConnectFunction · 0.85
cliFormatReplyRawFunction · 0.85
cliReadReplyFunction · 0.85
cliSendCommandFunction · 0.85
replFunction · 0.85

Calls 5

sdsemptyFunction · 0.85
sdscatfmtFunction · 0.85
anetFormatAddrFunction · 0.85
sdscatlenFunction · 0.85
sdsfreeFunction · 0.85

Tested by

no test coverage detected