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

Function select_update_variant

src/cli/cli.c:4280–4305  ·  view source on GitHub ↗

Select update variant. Returns 0=standard, 1=ui, -1=error. */

Source from the content-addressed store, hash-verified

4278
4279/* Select update variant. Returns 0=standard, 1=ui, -1=error. */
4280static int select_update_variant(int variant_flag) {
4281 if (variant_flag == VARIANT_A) {
4282 return 0;
4283 }
4284 if (variant_flag == VARIANT_B) {
4285 return CLI_TRUE;
4286 }
4287#ifndef _WIN32
4288 if (!isatty(fileno(stdin))) {
4289 (void)fprintf(stderr, "error: variant selection requires a terminal. "
4290 "Use --standard or --ui flag.\n");
4291 return CLI_ERR;
4292 }
4293#endif
4294 printf("Which binary variant do you want?\n");
4295 printf(" 1) standard — MCP server only\n");
4296 printf(" 2) ui — MCP server + embedded graph visualization\n");
4297 printf("Choose (1/2): ");
4298 (void)fflush(stdout);
4299 char choice[CLI_BUF_16];
4300 if (!fgets(choice, sizeof(choice), stdin)) {
4301 (void)fprintf(stderr, "error: failed to read input\n");
4302 return CLI_ERR;
4303 }
4304 return (choice[0] == '2') ? CLI_TRUE : 0;
4305}
4306
4307/* Case-insensitive prefix match (portable — no strncasecmp dependency). */
4308static bool prefix_icase(const char *s, const char *prefix) {

Callers 1

cbm_cmd_updateFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected