From 9870624e1033bd28f944734ad4186ac38f1ca630 Mon Sep 17 00:00:00 2001 From: axtlos <3alouchi2006@gmail.com> Date: Tue, 31 Aug 2021 21:55:33 +0200 Subject: [PATCH] added short and longer commands --- Cargo.toml | 2 +- README.md | 6 +++--- src/main.rs | 22 +++++++++++----------- src/mods/config.rs | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d27bf15..0cbab8f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "ame" version = "2.0.0" -authors = [ "jnats ", "axtlos " ] +authors = [ "jnats ", "axtlos " ] edition = "2018" description = "a fast and efficient aur helper." diff --git a/README.md b/README.md index fa5ba51..7d26bf3 100644 --- a/README.md +++ b/README.md @@ -23,12 +23,12 @@ Made for crystalux, compatible with any arch-based linux distribution.

| ------ | ------ | ------ | ------ | | Install a package | amethyst install | ame ins | -S | | Install a package via flatpak | amethyst flat | ame flat | -f | -| Remove a package| amethyst remove | ame rm | -R | +| Remove a package| amethyst remove | ame rem | -R | | Update repository | amethyst update | ame upd | -Sy | | Upgrade a package | amethyst upgrade | ame upg | -Syu | | Search for a package in repo and aur | amethyst search | ame sear | -Ss | -| Search for a package in repo | amethyst search -R | ame sear -R | -Ss -R | -| Search for a package in aur | amethyst search -A | ame sear -A | -Ss -A | +| Search for a package in repo | amethyst search-repo | ame serr | -Sr| +| Search for a package in aur | amethyst search-aur | ame sera | -Sa | ## How to build: diff --git a/src/main.rs b/src/main.rs index 9e946fe..23c3ad3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ struct AUR { fn main() { let args: Vec = env::args().collect(); - let mut file = File::open("config.toml").expect("Unable to open the Config file"); + let mut file = File::open(format!("{}/.config/ame/config.toml", std::env::var("HOME").unwrap())).expect("Unable to open the Config file"); let mut config = String::new(); file.read_to_string(&mut config).expect("Unable to read the Config file"); let configfile: General = toml::from_str(&config).unwrap(); @@ -42,7 +42,7 @@ fn main() { exit(1); } let oper = &args[1]; - if oper == "-S" { + if oper == "-S" || oper == "ins" || oper == "install" { for arg in env::args().skip(2) { if configfile.backends.pacman.unwrap() == true { let out = Command::new("pacman").arg("-Ss").arg(&arg).status().unwrap(); @@ -66,30 +66,30 @@ fn main() { exit(1); } } - } else if oper == "-R" { + } else if oper == "-R" || oper=="rem" || oper=="remove" { for arg in env::args().skip(2) { let configoption_noconfirm = configfile.pacman.noconfirm.unwrap(); uninstall(configoption_noconfirm, &arg); } - } else if oper == "-Syu" { + } else if oper == "-Syu" || oper=="upg" || oper=="upgrade" { let configoption_noconfirm = configfile.pacman.noconfirm.unwrap(); upgrade(configoption_noconfirm); - } else if oper == "-Ss" { + } else if oper == "-Ss" || oper=="sear" || oper=="search" { for arg in env::args().skip(2) { r_search(&arg); a_search(&arg); } - } else if oper == "-Sa" { + } else if oper == "-Sa" || oper=="sera" || oper=="search-aur" { for arg in env::args().skip(2) { a_search(&arg); } - } else if oper == "-Sr" { + } else if oper == "-Sr" || oper=="serr" || oper=="search-rep" { for arg in env::args().skip(2) { r_search(&arg); } - } else if oper == "-Cc" { + } else if oper == "-Cc" || oper=="clrca" || oper=="clear-cache" { clearcache(); - } else if oper == "-f" { + } else if oper == "-f" || oper=="flat" || oper=="flatpak" { if configfile.backends.flatpak.unwrap() == true { let b = std::path::Path::new("/usr/bin/flatpak").exists(); if b == true { @@ -106,7 +106,7 @@ fn main() { println!("Enable flatpak support in your configuration and try again!"); exit(1); } - } else if oper == "-s" { + } else if oper == "-s" || oper=="snap" { if configfile.backends.snap.unwrap() == true { let b = std::path::Path::new("/usr/bin/snap").exists(); if b == true { @@ -123,7 +123,7 @@ fn main() { println!("Enable snap support in your configuration and try again!"); exit(1); } - } else if oper == "-Pc" { + } else if oper == "-Pc" || oper=="pricon" || oper=="printconf" { printconfig(); } else { help(); diff --git a/src/mods/config.rs b/src/mods/config.rs index 625dae7..31855ef 100644 --- a/src/mods/config.rs +++ b/src/mods/config.rs @@ -33,7 +33,7 @@ struct AUR { pub fn printconfig() { let args: Vec = env::args().collect(); - let mut file = File::open("config.toml").expect("Unable to open the Config file"); + let mut file = File::open(format!("{}/.config/ame/config.toml", std::env::var("HOME").unwrap())).expect("Unable to open the Config file"); let mut config = String::new(); file.read_to_string(&mut config).expect("Unable to read the Config file"); let configfile: General = toml::from_str(&config).unwrap();