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

Function cbm_cmd_install

src/cli/cli.c:11020–11385  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11018}
11019
11020int cbm_cmd_install(int argc, char **argv) {
11021 parse_auto_answer(argc, argv);
11022 bool dry_run = false;
11023 bool force = false;
11024 bool plan = false;
11025 bool reset_indexes = false;
11026 bool skip_config = false;
11027 bool skip_binary = false;
11028 bool force_binary = false;
11029 const char *requested_clients = NULL;
11030 const char *requested_bin_dir = NULL;
11031 for (int i = 0; i < argc; i++) {
11032 if (strcmp(argv[i], "--dry-run") == 0) {
11033 dry_run = true;
11034 } else if (strcmp(argv[i], "--force") == 0) {
11035 force = true;
11036 } else if (strcmp(argv[i], "--plan") == 0) {
11037 plan = true;
11038 } else if (strcmp(argv[i], "--reset-indexes") == 0) {
11039 reset_indexes = true;
11040 } else if (strcmp(argv[i], "--skip-config") == 0) {
11041 skip_config = true;
11042 } else if (strncmp(argv[i], "--clients=", SLEN("--clients=")) == 0) {
11043 requested_clients = argv[i] + SLEN("--clients=");
11044 if (!requested_clients[0]) {
11045 (void)fprintf(stderr, "error: --clients requires a value\n\n");
11046 cli_clients_print_list(stderr);
11047 return CLI_TRUE;
11048 }
11049 } else if (strcmp(argv[i], "--clients") == 0) {
11050 /* Bare `--clients` (and `--clients=help`/`list`) print the
11051 * vocabulary, including tokens users would not readily guess. */
11052 cli_clients_print_list(stdout);
11053 return 0;
11054 } else if (strcmp(argv[i], "--skip-binary") == 0) {
11055 /* #1566: the mirror of --skip-config. Configure the agents, leave
11056 * the binary and PATH alone. */
11057 skip_binary = true;
11058 } else if (strcmp(argv[i], "--force-binary") == 0) {
11059 force_binary = true;
11060 } else if (strncmp(argv[i], "--dir=", SLEN("--dir=")) == 0) {
11061 requested_bin_dir = argv[i] + SLEN("--dir=");
11062 if (!requested_bin_dir[0]) {
11063 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
11064 return CLI_TRUE;
11065 }
11066 } else if (strcmp(argv[i], "--dir") == 0) {
11067 if (i + 1 >= argc || !argv[i + 1] || !argv[i + 1][0] || argv[i + 1][0] == '-') {
11068 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
11069 return CLI_TRUE;
11070 }
11071 requested_bin_dir = argv[++i];
11072 } else if (strcmp(argv[i], "-y") != 0 && strcmp(argv[i], "--yes") != 0 &&
11073 strcmp(argv[i], "-n") != 0 && strcmp(argv[i], "--no") != 0) {
11074 (void)fprintf(stderr, "error: unknown install option: %s\n", argv[i]);
11075 return CLI_TRUE;
11076 }
11077 }

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