Prompt to delete existing indexes. Returns 0 to continue, 1 to abort. */
| 4217 | |
| 4218 | /* Prompt to delete existing indexes. Returns 0 to continue, 1 to abort. */ |
| 4219 | static int update_clear_indexes(const char *home, bool dry_run) { |
| 4220 | int index_count = count_db_indexes(home); |
| 4221 | if (index_count == 0) { |
| 4222 | return 0; |
| 4223 | } |
| 4224 | printf("Found %d existing index(es) that must be rebuilt after update:\n", index_count); |
| 4225 | cbm_list_indexes(home); |
| 4226 | printf("\n"); |
| 4227 | if (dry_run) { |
| 4228 | printf("(dry-run — indexes would be deleted)\n\n"); |
| 4229 | return 0; |
| 4230 | } |
| 4231 | if (!prompt_yn("Delete these indexes and continue with update?")) { |
| 4232 | printf("Update cancelled.\n"); |
| 4233 | return CLI_TRUE; |
| 4234 | } |
| 4235 | int removed = cbm_remove_indexes(home); |
| 4236 | printf("Removed %d index(es).\n\n", removed); |
| 4237 | return 0; |
| 4238 | } |
| 4239 | |
| 4240 | /* Download, verify checksum, kill old instances, and install binary. Returns 0 on success. */ |
| 4241 | static int download_verify_install(const char *url, const char *ext, const char *os, |
no test coverage detected