upd parser

This commit is contained in:
pivodevat
2025-08-25 00:34:04 +03:00
parent eeb4377bb3
commit 12583471f1
4 changed files with 24 additions and 30 deletions

View File

@ -39,31 +39,28 @@ pub fn get_url<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
pub fn get_build_deps<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` cfg build dependencies", "```")
extract_block(file_path, "``` cfg *** build deps ***", "```")
}
pub fn get_run_deps<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` cfg build dependencies", "```")
extract_block(file_path, "``` cfg *** run deps ***", "```")
}
pub fn get_build_script<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` sh build.sctipt", "```")
extract_block(file_path, "``` sh *** build ***", "```")
}
pub fn get_config_script<P: AsRef<Path>>(file_path: P) -> io::Result<String> {
extract_block(file_path, "``` sh build.config", "```")
extract_block(file_path, "``` sh *** config ***", "```")
}
pub fn get_repo_list() -> io::Result<Vec<String>> {
let exe_path = env::current_exe()?;
let file_path = exe_path
.parent()
.ok_or_else(|| io::Error::new(io::ErrorKind::Other, "Failed to get executable directory"))?
.join("../etc/sexpkg.md");
let base_path = env!("SEXPKG_HOME");
let file_path = PathBuf::from(base_path).join("var").join("sexpkg.md");
let block = extract_block(file_path, "``` sh *** Repository list and priority ***", "```")?;
let block = extract_block(file_path, "``` cfg *** Repository list and priority ***", "```")?;
let mut repo_list = Vec::new();
for line in block.lines() {