2020-05-31 08:38:20 +03:00

39 lines
1.2 KiB
Rust

use anyhow::anyhow;
use std::str::FromStr;
pub struct AurHelper {
pub name: String,
pub install_command: Vec<String>,
}
impl FromStr for AurHelper {
type Err = anyhow::Error;
fn from_str(s: &str) -> anyhow::Result<Self> {
match s {
"yay" => Ok(AurHelper {
name: String::from("yay"),
install_command: vec![
String::from("yay"),
String::from("-S"),
String::from("--nocleanmenu"),
String::from("--nodiffmenu"),
String::from("--noeditmenu"),
String::from("--noupgrademenu"),
String::from("--useask"),
String::from("--removemake"),
String::from("--norebuild"),
String::from("--noconfirm"),
String::from("--answeredit"),
String::from("None"),
String::from("--answerclean"),
String::from("None"),
String::from("--mflags"),
String::from("--noconfirm"),
],
}),
_ => Err(anyhow!("Error parsing AUR helper string: {}", s)),
}
}
}