added flatpak install method

i18n
axtloss 3 years ago
parent 16c38b3d9b
commit fe741b862f

@ -22,6 +22,7 @@ Made for crystalux, compatible with any arch-based linux distribution.</p>
| Action | Command | Shorthand alias | Supported pacman equivalent | | Action | Command | Shorthand alias | Supported pacman equivalent |
| ------ | ------ | ------ | ------ | | ------ | ------ | ------ | ------ |
| Install a package | amethyst install | ame ins | -S | | 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 rm | -R |
| Update repository | amethyst update | ame upd | -Sy | | Update repository | amethyst update | ame upd | -Sy |
| Upgrade a package | amethyst upgrade | ame upg | -Syu | | Upgrade a package | amethyst upgrade | ame upg | -Syu |

@ -1,5 +1,5 @@
mod mods; 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}; use std::{env, process::exit, process::Command};
fn main() { fn main() {
@ -41,6 +41,10 @@ fn main() {
} }
} else if oper == "-Cc" { } else if oper == "-Cc" {
clearcache(); clearcache();
} else if oper == "-f" {
for arg in env::args().skip(2) {
flatpak(&arg);
}
} else { } else {
help(); help();
exit(0); exit(0);

@ -4,4 +4,5 @@ pub mod help;
pub mod install; pub mod install;
pub mod search; pub mod search;
pub mod uninstall; pub mod uninstall;
pub mod upgrade; pub mod upgrade;
pub mod flatpak;

@ -15,7 +15,6 @@ pub fn clone(pkg: &str) {
println!("Installing {} ...", pkg); println!("Installing {} ...", pkg);
Command::new("makepkg") Command::new("makepkg")
.current_dir(&cachedir) .current_dir(&cachedir)
.arg("--noconfirm")
.arg("-si") .arg("-si")
.status() .status()
.expect(&error); .expect(&error);

@ -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);
}

@ -2,6 +2,7 @@ pub fn help() {
println!("\ println!("\
Usage:\n Usage:\n
ame -S <pkg> - install a package ame -S <pkg> - install a package
ame -f <pkg> - install a package via flatpak
ame -R <pkg> - remove a package ame -R <pkg> - remove a package
ame -Syu - system upgrade ame -Syu - system upgrade
ame -Ss <pkg> - search for a package ame -Ss <pkg> - search for a package

Loading…
Cancel
Save