upd parser
This commit is contained in:
@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user