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

Function cbm_cmd_install

src/cli/cli.c:9825–10185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9823}
9824
9825int cbm_cmd_install(int argc, char **argv) {
9826 parse_auto_answer(argc, argv);
9827 bool dry_run = false;
9828 bool force = false;
9829 bool plan = false;
9830 bool reset_indexes = false;
9831 bool skip_config = false;
9832 bool skip_binary = false;
9833 bool force_binary = false;
9834 const char *requested_clients = NULL;
9835 const char *requested_bin_dir = NULL;
9836 for (int i = 0; i < argc; i++) {
9837 if (strcmp(argv[i], "--dry-run") == 0) {
9838 dry_run = true;
9839 } else if (strcmp(argv[i], "--force") == 0) {
9840 force = true;
9841 } else if (strcmp(argv[i], "--plan") == 0) {
9842 plan = true;
9843 } else if (strcmp(argv[i], "--reset-indexes") == 0) {
9844 reset_indexes = true;
9845 } else if (strcmp(argv[i], "--skip-config") == 0) {
9846 skip_config = true;
9847 } else if (strncmp(argv[i], "--clients=", SLEN("--clients=")) == 0) {
9848 requested_clients = argv[i] + SLEN("--clients=");
9849 if (!requested_clients[0]) {
9850 (void)fprintf(stderr, "error: --clients requires a value\n\n");
9851 cli_clients_print_list(stderr);
9852 return CLI_TRUE;
9853 }
9854 } else if (strcmp(argv[i], "--clients") == 0) {
9855 /* Bare `--clients` (and `--clients=help`/`list`) print the
9856 * vocabulary. 26 clients ship with tokens nobody would guess. */
9857 cli_clients_print_list(stdout);
9858 return 0;
9859 } else if (strcmp(argv[i], "--skip-binary") == 0) {
9860 /* #1566: the mirror of --skip-config. Configure the agents, leave
9861 * the binary and PATH alone. */
9862 skip_binary = true;
9863 } else if (strcmp(argv[i], "--force-binary") == 0) {
9864 force_binary = true;
9865 } else if (strncmp(argv[i], "--dir=", SLEN("--dir=")) == 0) {
9866 requested_bin_dir = argv[i] + SLEN("--dir=");
9867 if (!requested_bin_dir[0]) {
9868 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
9869 return CLI_TRUE;
9870 }
9871 } else if (strcmp(argv[i], "--dir") == 0) {
9872 if (i + 1 >= argc || !argv[i + 1] || !argv[i + 1][0] || argv[i + 1][0] == '-') {
9873 (void)fprintf(stderr, "error: --dir requires a non-empty path\n");
9874 return CLI_TRUE;
9875 }
9876 requested_bin_dir = argv[++i];
9877 } else if (strcmp(argv[i], "-y") != 0 && strcmp(argv[i], "--yes") != 0 &&
9878 strcmp(argv[i], "-n") != 0 && strcmp(argv[i], "--no") != 0) {
9879 (void)fprintf(stderr, "error: unknown install option: %s\n", argv[i]);
9880 return CLI_TRUE;
9881 }
9882 }

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