add install and remove packages to Backend trait
This commit is contained in:
-20
@@ -1,11 +1,9 @@
|
||||
use std::os::unix::process::CommandExt;
|
||||
use std::path::PathBuf;
|
||||
use std::process::{Command, ExitStatus};
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
|
||||
use crate::env::get_editor;
|
||||
use crate::Package;
|
||||
|
||||
pub fn run_edit_command(files: &[PathBuf]) -> Result<ExitStatus> {
|
||||
let mut cmd = Command::new(get_editor()?);
|
||||
@@ -14,21 +12,3 @@ pub fn run_edit_command(files: &[PathBuf]) -> Result<ExitStatus> {
|
||||
}
|
||||
cmd.status().map_err(|e| anyhow!(e))
|
||||
}
|
||||
|
||||
pub fn run_install_command(diff: Vec<Package>) {
|
||||
let mut cmd = Command::new("paru");
|
||||
cmd.arg("-S");
|
||||
for p in diff {
|
||||
cmd.arg(format!("{p}"));
|
||||
}
|
||||
cmd.exec();
|
||||
}
|
||||
|
||||
pub fn run_remove_command(unmanaged: Vec<Package>) {
|
||||
let mut cmd = Command::new("paru");
|
||||
cmd.arg("-Rsn");
|
||||
for p in unmanaged {
|
||||
cmd.arg(format!("{p}"));
|
||||
}
|
||||
cmd.exec();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user