diff --git a/ame.toml b/ame.toml index 6bf503b..b57a60e 100644 --- a/ame.toml +++ b/ame.toml @@ -8,6 +8,3 @@ aur = true [pacman] noconfirm = false - -[aur] -clone_path = "/home/ali/.ame" diff --git a/src/main.rs b/src/main.rs index b46a462..ccb07e0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,7 +9,6 @@ struct General { cache: Option, backends: Backends, pacman: Pacman, - aur: AUR, } #[derive(serde::Deserialize)] @@ -25,11 +24,6 @@ struct Pacman { noconfirm: Option, } -#[derive(serde::Deserialize)] -struct AUR { - clone_path: Option, -} - fn main() { let args: Vec = 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/??"); @@ -45,14 +39,12 @@ fn main() { [pacman] noconfirm = false - - [aur] - clone_path = "{}/.cache/ame" - "#, std::env::var("HOME").unwrap(), std::env::var("HOME").unwrap()); +" + "#, std::env::var("HOME").unwrap()); let mut configfile: General = toml::from_str(&defaultconfig).unwrap(); - if fs::read_to_string("/etc/ame.toml").expect("unable to open config file!") != "" { - confile.read_to_string(&mut config).expect("Unable to read the 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 (/etc/ame.toml)"); configfile = toml::from_str(&config).unwrap(); } @@ -61,7 +53,7 @@ fn main() { exit(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" { for arg in env::args().skip(2) { if configfile.backends.pacman.unwrap() == true { diff --git a/src/mods/config.rs b/src/mods/config.rs index 7ff8b1c..f35d49b 100644 --- a/src/mods/config.rs +++ b/src/mods/config.rs @@ -8,7 +8,6 @@ struct General { cache: Option, backends: Backends, pacman: Pacman, - aur: AUR, } #[derive(serde::Deserialize)] @@ -24,11 +23,6 @@ struct Pacman { noconfirm: Option, } -#[derive(serde::Deserialize)] -struct AUR { - clone_path: Option, -} - pub fn printconfig() { @@ -45,13 +39,10 @@ pub fn printconfig() { [pacman] noconfirm = false - - [aur] - clone_path = "{}/.cache/ame" - "#, std::env::var("HOME").unwrap(), std::env::var("HOME").unwrap()); + "#, std::env::var("HOME").unwrap()); let mut configfile: General = toml::from_str(&defaultconfig).unwrap(); - if fs::read_to_string("/etc/ame.toml").expect("unable to open config file!") != "" { - confile.read_to_string(&mut config).expect("Unable to read the 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 (/etc/ame.toml)"); configfile = toml::from_str(&config).unwrap(); } println!("\ @@ -66,7 +57,5 @@ Backends: Pacman: noconfirm: {} - -aur: - Clone directory: {}", configfile.cache.unwrap(), configfile.backends.pacman.unwrap(), configfile.backends.aur.unwrap(), configfile.backends.flatpak.unwrap(), configfile.backends.snap.unwrap(), configfile.pacman.noconfirm.unwrap(), configfile.aur.clone_path.unwrap()) +", configfile.cache.unwrap(), configfile.backends.pacman.unwrap(), configfile.backends.aur.unwrap(), configfile.backends.flatpak.unwrap(), configfile.backends.snap.unwrap(), configfile.pacman.noconfirm.unwrap()); } \ No newline at end of file