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

Function cbm_cmd_install

src/cli/cli.c:9990–10350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9988}
9989
9990int cbm_cmd_install(int argc, char **argv) {
9991 parse_auto_answer(argc, argv);
9992 bool dry_run = false;
9993 bool force = false;
9994 bool plan = false;
9995 bool reset_indexes = false;
9996 bool skip_config = false;
9997 bool skip_binary = false;
9998 bool force_binary = false;
9999 const char *requested_clients = NULL;
10000 const char *requested_bin_dir = NULL;
10001 for (int i = 0; i < argc; i++) {
10002 if (strcmp(argv[i], "--dry-run") == 0) {
10003 dry_run = true;
10004 } else if (strcmp(argv[i], "--force") == 0) {
10005 force = true;
10006 } else if (strcmp(argv[i], "--plan") == 0) {
10007 plan = true;
10008 } else if (strcmp(argv[i], "--reset-indexes") == 0) {
10009 reset_indexes = true;
10010 } else if (strcmp(argv[i], "--skip-config") == 0) {
10011 skip_config = true;
10012 } else if (strncmp(argv[i], "--clients=", SLEN("--clients=")) == 0) {
10013 requested_clients = argv[i] + SLEN("--clients=");
10014 if (!requested_clients[0]) {
10015 (void)fprintf(stderr, "error: --clients requires a value\n\n");
10016 cli_clients_print_list(stderr);
10017 return CLI_TRUE;
10018 }
10019 } else if (strcmp(argv[i], "--clients") == 0) {
10020 /* Bare `--clients` (and `--clients=help`/`list`) print the
10021 * vocabulary. 26 clients ship with tokens nobody would guess. */
10022 cli_clients_print_list(stdout);
10023 return 0;
10024 } else if (strcmp(argv[i], "--skip-binary") == 0) {
10025 /* #1566: the mirror of --skip-config. Configure the agents, leave
10026 * the binary and PATH alone. */
10027 skip_binary = true;
10028 } else if (strcmp(argv[i], "--force-binary") == 0) {
10029 force_binary = true;
10030 } else if (strncmp(argv[i], "--dir=", SLEN("--dir=")) == 0) {
10031 requested_bin_dir = argv[i] + SLEN("--dir=");
10032 if (!requested_bin_dir[0]) {
10033 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
10034 return CLI_TRUE;
10035 }
10036 } else if (strcmp(argv[i], "--dir") == 0) {
10037 if (i + 1 >= argc || !argv[i + 1] || !argv[i + 1][0] || argv[i + 1][0] == '-') {
10038 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
10039 return CLI_TRUE;
10040 }
10041 requested_bin_dir = argv[++i];
10042 } else if (strcmp(argv[i], "-y") != 0 && strcmp(argv[i], "--yes") != 0 &&
10043 strcmp(argv[i], "-n") != 0 && strcmp(argv[i], "--no") != 0) {
10044 (void)fprintf(stderr, "error: unknown install option: %s\n", argv[i]);
10045 return CLI_TRUE;
10046 }
10047 }

Callers 1

handle_subcommandFunction · 0.85

Calls 15

parse_auto_answerFunction · 0.85
cli_clients_print_listFunction · 0.85
cbm_get_home_dirFunction · 0.85
cbm_normalize_path_sepFunction · 0.85
cbm_detect_agentsFunction · 0.85
cbm_detect_self_pathFunction · 0.85
cbm_path_info_utf8Function · 0.85
cbm_same_fileFunction · 0.85

Tested by

no test coverage detected