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

Function config_ui_write

src/cli/cli.c:7666–7689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7664}
7665
7666static int config_ui_write(const char *key, const char *value) {
7667 cbm_ui_config_t ui;
7668 cbm_ui_config_load(&ui);
7669 if (strcmp(key, CBM_CONFIG_UI_ENABLED) == 0) {
7670 if (strcmp(value, "true") != 0 && strcmp(value, "false") != 0) {
7671 (void)fprintf(stderr, "error: %s must be true or false\n", key);
7672 return CLI_ERR;
7673 }
7674 ui.ui_enabled = strcmp(value, "true") == 0;
7675 } else {
7676 char *end = NULL;
7677 long port = strtol(value, &end, 10);
7678 if (!end || *end || port < 1 || port > 65535) {
7679 (void)fprintf(stderr, "error: %s must be a port between 1 and 65535\n", key);
7680 return CLI_ERR;
7681 }
7682 ui.ui_port = (int)port;
7683 }
7684 if (!cbm_ui_config_save(&ui)) {
7685 (void)fprintf(stderr, "error: could not write the UI configuration file\n");
7686 return CLI_ERR;
7687 }
7688 return CLI_OK;
7689}
7690
7691static const config_key_def_t *config_key_lookup(const char *key) {
7692 for (size_t i = 0; key && i < sizeof(CONFIG_KEYS) / sizeof(CONFIG_KEYS[0]); i++) {

Callers 1

cbm_cmd_configFunction · 0.85

Calls 2

cbm_ui_config_loadFunction · 0.85
cbm_ui_config_saveFunction · 0.85

Tested by

no test coverage detected