added config changes, view comments for details
parent
8c26afa026
commit
9e565eaffd
@ -0,0 +1,13 @@
|
||||
cache = "/home/user/.cache/ame"
|
||||
|
||||
[backends]
|
||||
pacman = true
|
||||
flatpak = false
|
||||
snap = false
|
||||
aur = true
|
||||
|
||||
[pacman]
|
||||
noconfirm = true
|
||||
|
||||
[aur]
|
||||
clone_path = "/home/user/.cache/ame"
|
@ -1,6 +1,11 @@
|
||||
use runas::Command;
|
||||
|
||||
pub fn install(pkg: &str) {
|
||||
pub fn install(noconfirm: bool, pkg: &str) {
|
||||
println!("{}",noconfirm);
|
||||
let errstr = format!("Oops.. Something went wrong!");
|
||||
Command::new("pacman").arg("-S").arg(&pkg).status().expect(&errstr);
|
||||
if (noconfirm == false) {
|
||||
Command::new("pacman").arg("-S").arg(&pkg).status().expect(&errstr);
|
||||
} else {
|
||||
Command::new("pacman").arg("-S").arg("--noconfirm").arg(&pkg).status().expect(&errstr);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,11 @@
|
||||
use std::process::Command;
|
||||
use runas::Command;
|
||||
|
||||
pub fn uninstall(pkg: &str) {
|
||||
pub fn uninstall(noconfirm: bool, pkg: &str) {
|
||||
let errstr = format!("Could not remove package {}", pkg);
|
||||
Command::new("sudo")
|
||||
.arg("pacman")
|
||||
.arg("-R")
|
||||
.arg("--noconfirm")
|
||||
.arg(&pkg)
|
||||
.status()
|
||||
.expect(&errstr);
|
||||
|
||||
if (noconfirm == false) {
|
||||
Command::new("pacman").arg("-R").arg(&pkg).status().expect(&errstr);
|
||||
} else {
|
||||
Command::new("pacman").arg("-R").arg("--noconfirm").arg(&pkg).status().expect(&errstr);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,17 @@
|
||||
use std::process::Command;
|
||||
use runas::Command;
|
||||
|
||||
pub fn upgrade() {
|
||||
pub fn upgrade(noconfirm: bool) {
|
||||
let errstr = format!("Something happened");
|
||||
Command::new("pacman")
|
||||
.arg("-Syu")
|
||||
.status()
|
||||
.expect(&errstr);
|
||||
if (noconfirm == true) {
|
||||
Command::new("pacman")
|
||||
.arg("-Syu")
|
||||
.arg("--noconfirm")
|
||||
.status()
|
||||
.expect(&errstr);
|
||||
} else {
|
||||
Command::new("pacman")
|
||||
.arg("-Syu")
|
||||
.status()
|
||||
.expect(&errstr);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue