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

Function prompt_yn

src/cli/cli.c:2935–2962  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2933}
2934
2935static bool prompt_yn(const char *question) {
2936 if (g_auto_answer == AUTO_YES) {
2937 printf("%s (y/n): y (auto)\n", question);
2938 return true;
2939 }
2940 if (g_auto_answer == AUTO_NO) {
2941 printf("%s (y/n): n (auto)\n", question);
2942 return false;
2943 }
2944
2945 /* Non-interactive stdin: default to "no" to avoid hanging */
2946#ifndef _WIN32
2947 if (!isatty(fileno(stdin))) {
2948 (void)fprintf(stderr,
2949 "error: interactive prompt requires a terminal. Use -y or -n flags.\n");
2950 return false;
2951 }
2952#endif
2953
2954 printf("%s (y/n): ", question);
2955 (void)fflush(stdout);
2956
2957 char buf[CLI_BUF_16];
2958 if (!fgets(buf, sizeof(buf), stdin)) {
2959 return false;
2960 }
2961 return (buf[0] == 'y' || buf[0] == 'Y') ? true : false;
2962}
2963
2964/* ── SHA-256 checksum verification ─────────────────────────────── */
2965

Callers 4

cbm_cmd_installFunction · 0.85
cbm_cmd_uninstallFunction · 0.85
update_clear_indexesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected