From fe741b862f82a720a29fd78de622c8649c54c726 Mon Sep 17 00:00:00 2001 From: axtloss <3alouchi2006@gmail.com> Date: Wed, 11 Aug 2021 08:47:36 +0000 Subject: [PATCH] added flatpak install method --- README.md | 1 + src/main.rs | 6 +++++- src/mods.rs | 3 ++- src/mods/clone.rs | 1 - src/mods/flatpak.rs | 11 +++++++++++ src/mods/help.rs | 1 + 6 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 src/mods/flatpak.rs diff --git a/README.md b/README.md index eb08e68..fa5ba51 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Made for crystalux, compatible with any arch-based linux distribution.

| Action | Command | Shorthand alias | Supported pacman equivalent | | ------ | ------ | ------ | ------ | | 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 | | Update repository | amethyst update | ame upd | -Sy | | Upgrade a package | amethyst upgrade | ame upg | -Syu | diff --git a/src/main.rs b/src/main.rs index e6514b0..e8e7bc8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ mod mods; -use mods::{clearcache::clearcache, clone::clone, help::help, install::install, search::{a_search, r_search}, uninstall::uninstall, upgrade::upgrade}; +use mods::{clearcache::clearcache, clone::clone, help::help, install::install, search::{a_search, r_search}, uninstall::uninstall, upgrade::upgrade, flatpak::flatpak}; use std::{env, process::exit, process::Command}; fn main() { @@ -41,6 +41,10 @@ fn main() { } } else if oper == "-Cc" { clearcache(); + } else if oper == "-f" { + for arg in env::args().skip(2) { + flatpak(&arg); + } } else { help(); exit(0); diff --git a/src/mods.rs b/src/mods.rs index 0420841..65c173d 100644 --- a/src/mods.rs +++ b/src/mods.rs @@ -4,4 +4,5 @@ pub mod help; pub mod install; pub mod search; pub mod uninstall; -pub mod upgrade; \ No newline at end of file +pub mod upgrade; +pub mod flatpak; \ No newline at end of file diff --git a/src/mods/clone.rs b/src/mods/clone.rs index 1e22e9a..9c904ea 100644 --- a/src/mods/clone.rs +++ b/src/mods/clone.rs @@ -15,7 +15,6 @@ pub fn clone(pkg: &str) { println!("Installing {} ...", pkg); Command::new("makepkg") .current_dir(&cachedir) - .arg("--noconfirm") .arg("-si") .status() .expect(&error); diff --git a/src/mods/flatpak.rs b/src/mods/flatpak.rs new file mode 100644 index 0000000..251cbf2 --- /dev/null +++ b/src/mods/flatpak.rs @@ -0,0 +1,11 @@ +use std::process::Command; + + +pub fn flatpak(pkg:&str) { + let error = format!("Couldn't install {}", &pkg); + Command::new("flatpak") + .arg("install") + .arg(&pkg) + .status() + .expect(&error); +} \ No newline at end of file diff --git a/src/mods/help.rs b/src/mods/help.rs index 8e958d7..687dbbb 100644 --- a/src/mods/help.rs +++ b/src/mods/help.rs @@ -2,6 +2,7 @@ pub fn help() { println!("\ Usage:\n ame -S - install a package +ame -f - install a package via flatpak ame -R - remove a package ame -Syu - system upgrade ame -Ss - search for a package