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

Function cliRefreshPrompt

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

Source from the content-addressed store, hash-verified

298}
299
300static void cliRefreshPrompt(void) {
301 if (config.eval_ldb) return;
302
303 sds prompt = sdsempty();
304 if (config.hostsocket != NULL) {
305 prompt = sdscatfmt(prompt,"redis %s",config.hostsocket);
306 } else {
307 char addr[256];
308 anetFormatAddr(addr, sizeof(addr), config.hostip, config.hostport);
309 prompt = sdscatlen(prompt,addr,strlen(addr));
310 }
311
312 /* Add [dbnum] if needed */
313 if (config.dbnum != 0)
314 prompt = sdscatfmt(prompt,"[%i]",config.dbnum);
315
316 /* Add TX if in transaction state*/
317 if (config.in_multi)
318 prompt = sdscatlen(prompt,"(TX)",4);
319
320 /* Copy the prompt in the static buffer. */
321 prompt = sdscatlen(prompt,"> ",2);
322 snprintf(config.prompt,sizeof(config.prompt),"%s",prompt);
323 sdsfree(prompt);
324}
325
326/* Return the name of the dotfile for the specified 'dotfilename'.
327 * Normally it just concatenates user $HOME to the file specified

Callers 6

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

Calls 6

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

Tested by

no test coverage detected