before index-conflict changes

This commit is contained in:
2025-11-18 19:46:36 +03:00
parent 28ba2135ec
commit 30540602bd
66 changed files with 1403 additions and 879 deletions

View File

@ -0,0 +1,38 @@
use super::*;
pub fn get_repo_addr(repo: &str) -> String {
let file_path = &crate::commands::get_etc_path().join("aeropkg.md");
let block = extract_block(file_path, "``` cfg *** Repository list and priority ***", "```").expect("Can't parse repo list block");
for line in block.lines() {
let trimmed_line = line.trim();
if !trimmed_line.is_empty() {
let parts: Vec<&str> = trimmed_line.split_whitespace().collect();
if parts.len() >= 2 && parts[0] == repo {
return parts[1].to_string()
}
}
}
panic!("Repository '{}' not found in the repository list", repo);
}
pub fn get_repo_list() -> Vec<String> {
let file_path = &crate::commands::get_etc_path().join("aeropkg.md");
let block = extract_block(file_path, "``` cfg *** Repository list and priority ***", "```").expect("Can't parse repo list block");
let mut repo_list = Vec::new();
for line in block.lines() {
let trimmed_line = line.trim();
if !trimmed_line.is_empty() {
let parts: Vec<&str> = trimmed_line.split_whitespace().collect();
if let Some(repo) = parts.first() {
repo_list.push(repo.to_string());
}
}
}
repo_list
}