MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / prompt_yn

Function prompt_yn

src/cli/cli.c:6673–6700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6671}
6672
6673static bool prompt_yn(const char *question) {
6674 if (g_auto_answer == AUTO_YES) {
6675 printf("%s (y/n): y (auto)\n", question);
6676 return true;
6677 }
6678 if (g_auto_answer == AUTO_NO) {
6679 printf("%s (y/n): n (auto)\n", question);
6680 return false;
6681 }
6682
6683 /* Non-interactive stdin: default to "no" to avoid hanging */
6684#ifndef _WIN32
6685 if (!isatty(fileno(stdin))) {
6686 (void)fprintf(stderr,
6687 "error: interactive prompt requires a terminal. Use -y or -n flags.\n");
6688 return false;
6689 }
6690#endif
6691
6692 printf("%s (y/n): ", question);
6693 (void)fflush(stdout);
6694
6695 char buf[CLI_BUF_16];
6696 if (!fgets(buf, sizeof(buf), stdin)) {
6697 return false;
6698 }
6699 return (buf[0] == 'y' || buf[0] == 'Y') ? true : false;
6700}
6701
6702/* ── SHA-256 checksum verification ─────────────────────────────── */
6703

Callers 4

cbm_cmd_installFunction · 0.85
cbm_cmd_uninstallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected