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

Function cbm_list_indexes

src/cli/cli.c:6397–6419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6395}
6396
6397int cbm_list_indexes(const char *home_dir) {
6398 const char *cache_dir = get_cache_dir(home_dir);
6399 if (!cache_dir) {
6400 return 0;
6401 }
6402
6403 cbm_dir_t *d = cbm_opendir(cache_dir);
6404 if (!d) {
6405 return 0;
6406 }
6407
6408 int count = 0;
6409 cbm_dirent_t *ent;
6410 while ((ent = cbm_readdir(d)) != NULL) {
6411 size_t len = strlen(ent->name);
6412 if (len > DB_EXT_LEN && strcmp(ent->name + len - DB_EXT_LEN, ".db") == 0) {
6413 printf(" %s/%s\n", cache_dir, ent->name);
6414 count++;
6415 }
6416 }
6417 cbm_closedir(d);
6418 return count;
6419}
6420
6421int cbm_remove_indexes(const char *home_dir) {
6422 const char *cache_dir = get_cache_dir(home_dir);

Callers 3

cbm_cmd_uninstallFunction · 0.85

Calls 4

get_cache_dirFunction · 0.85
cbm_opendirFunction · 0.85
cbm_readdirFunction · 0.85
cbm_closedirFunction · 0.85

Tested by

no test coverage detected