|
|
@ -9,7 +9,6 @@ struct General {
|
|
|
|
cache: Option<String>,
|
|
|
|
cache: Option<String>,
|
|
|
|
backends: Backends,
|
|
|
|
backends: Backends,
|
|
|
|
pacman: Pacman,
|
|
|
|
pacman: Pacman,
|
|
|
|
aur: AUR,
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(serde::Deserialize)]
|
|
|
|
#[derive(serde::Deserialize)]
|
|
|
@ -25,11 +24,6 @@ struct Pacman {
|
|
|
|
noconfirm: Option<bool>,
|
|
|
|
noconfirm: Option<bool>,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(serde::Deserialize)]
|
|
|
|
|
|
|
|
struct AUR {
|
|
|
|
|
|
|
|
clone_path: Option<String>,
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
fn main() {
|
|
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
let mut confile = File::open("/etc/ame.toml").expect("Unable to open the Config file, did you delete ame.toml from /etc/??");
|
|
|
|
let mut confile = File::open("/etc/ame.toml").expect("Unable to open the Config file, did you delete ame.toml from /etc/??");
|
|
|
@ -45,14 +39,12 @@ fn main() {
|
|
|
|
|
|
|
|
|
|
|
|
[pacman]
|
|
|
|
[pacman]
|
|
|
|
noconfirm = false
|
|
|
|
noconfirm = false
|
|
|
|
|
|
|
|
"
|
|
|
|
[aur]
|
|
|
|
"#, std::env::var("HOME").unwrap());
|
|
|
|
clone_path = "{}/.cache/ame"
|
|
|
|
|
|
|
|
"#, std::env::var("HOME").unwrap(), std::env::var("HOME").unwrap());
|
|
|
|
|
|
|
|
let mut configfile: General = toml::from_str(&defaultconfig).unwrap();
|
|
|
|
let mut configfile: General = toml::from_str(&defaultconfig).unwrap();
|
|
|
|
|
|
|
|
|
|
|
|
if fs::read_to_string("/etc/ame.toml").expect("unable to open config file!") != "" {
|
|
|
|
if fs::read_to_string("/etc/ame.toml").expect("unable to open config file! (/etc/ame.toml)") != "" {
|
|
|
|
confile.read_to_string(&mut config).expect("Unable to read the Config file");
|
|
|
|
confile.read_to_string(&mut config).expect("Unable to read the Config file (/etc/ame.toml)");
|
|
|
|
configfile = toml::from_str(&config).unwrap();
|
|
|
|
configfile = toml::from_str(&config).unwrap();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -61,7 +53,7 @@ fn main() {
|
|
|
|
exit(1);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
let oper = &args[1];
|
|
|
|
let oper = &args[1];
|
|
|
|
let clone_path=configfile.aur.clone_path.unwrap();
|
|
|
|
let clone_path=configfile.cache.unwrap();
|
|
|
|
if oper == "-S" || oper == "ins" || oper == "install" {
|
|
|
|
if oper == "-S" || oper == "ins" || oper == "install" {
|
|
|
|
for arg in env::args().skip(2) {
|
|
|
|
for arg in env::args().skip(2) {
|
|
|
|
if configfile.backends.pacman.unwrap() == true {
|
|
|
|
if configfile.backends.pacman.unwrap() == true {
|
|
|
|