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

Function cbm_cmd_install

src/cli/cli.c:9763–10123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9761}
9762
9763int cbm_cmd_install(int argc, char **argv) {
9764 parse_auto_answer(argc, argv);
9765 bool dry_run = false;
9766 bool force = false;
9767 bool plan = false;
9768 bool reset_indexes = false;
9769 bool skip_config = false;
9770 bool skip_binary = false;
9771 bool force_binary = false;
9772 const char *requested_clients = NULL;
9773 const char *requested_bin_dir = NULL;
9774 for (int i = 0; i < argc; i++) {
9775 if (strcmp(argv[i], "--dry-run") == 0) {
9776 dry_run = true;
9777 } else if (strcmp(argv[i], "--force") == 0) {
9778 force = true;
9779 } else if (strcmp(argv[i], "--plan") == 0) {
9780 plan = true;
9781 } else if (strcmp(argv[i], "--reset-indexes") == 0) {
9782 reset_indexes = true;
9783 } else if (strcmp(argv[i], "--skip-config") == 0) {
9784 skip_config = true;
9785 } else if (strncmp(argv[i], "--clients=", SLEN("--clients=")) == 0) {
9786 requested_clients = argv[i] + SLEN("--clients=");
9787 if (!requested_clients[0]) {
9788 (void)fprintf(stderr, "error: --clients requires a value\n\n");
9789 cli_clients_print_list(stderr);
9790 return CLI_TRUE;
9791 }
9792 } else if (strcmp(argv[i], "--clients") == 0) {
9793 /* Bare `--clients` (and `--clients=help`/`list`) print the
9794 * vocabulary. 26 clients ship with tokens nobody would guess. */
9795 cli_clients_print_list(stdout);
9796 return 0;
9797 } else if (strcmp(argv[i], "--skip-binary") == 0) {
9798 /* #1566: the mirror of --skip-config. Configure the agents, leave
9799 * the binary and PATH alone. */
9800 skip_binary = true;
9801 } else if (strcmp(argv[i], "--force-binary") == 0) {
9802 force_binary = true;
9803 } else if (strncmp(argv[i], "--dir=", SLEN("--dir=")) == 0) {
9804 requested_bin_dir = argv[i] + SLEN("--dir=");
9805 if (!requested_bin_dir[0]) {
9806 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
9807 return CLI_TRUE;
9808 }
9809 } else if (strcmp(argv[i], "--dir") == 0) {
9810 if (i + 1 >= argc || !argv[i + 1] || !argv[i + 1][0] || argv[i + 1][0] == '-') {
9811 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
9812 return CLI_TRUE;
9813 }
9814 requested_bin_dir = argv[++i];
9815 } else if (strcmp(argv[i], "-y") != 0 && strcmp(argv[i], "--yes") != 0 &&
9816 strcmp(argv[i], "-n") != 0 && strcmp(argv[i], "--no") != 0) {
9817 (void)fprintf(stderr, "error: unknown install option: %s\n", argv[i]);
9818 return CLI_TRUE;
9819 }
9820 }

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