|
|
@ -3,25 +3,25 @@ use crate::internal::{commands::ShellCommand, error::AppResult};
|
|
|
|
#[derive(Debug, Default)]
|
|
|
|
#[derive(Debug, Default)]
|
|
|
|
pub struct PaccacheBuilder {
|
|
|
|
pub struct PaccacheBuilder {
|
|
|
|
keep: i32,
|
|
|
|
keep: i32,
|
|
|
|
keep_ins: bool,
|
|
|
|
keep_ins_pkgs: bool,
|
|
|
|
quiet: bool,
|
|
|
|
quiet_output: bool,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
impl PaccacheBuilder {
|
|
|
|
impl PaccacheBuilder {
|
|
|
|
pub fn keep(mut self, keep: i32) -> Self {
|
|
|
|
pub fn set_keep(mut self, keep: i32) -> Self {
|
|
|
|
self.keep = keep;
|
|
|
|
self.keep = keep;
|
|
|
|
|
|
|
|
|
|
|
|
self
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn keep_ins(mut self, keep_ins: bool) -> Self {
|
|
|
|
pub fn keep_ins_pkgs(mut self, keep_ins_pkgs: bool) -> Self {
|
|
|
|
self.keep_ins = keep_ins;
|
|
|
|
self.keep_ins_pkgs = keep_ins_pkgs;
|
|
|
|
|
|
|
|
|
|
|
|
self
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn quiet(mut self, quiet: bool) -> Self {
|
|
|
|
pub fn quiet_output(mut self, quiet_output: bool) -> Self {
|
|
|
|
self.quiet = quiet;
|
|
|
|
self.quiet_output = quiet_output;
|
|
|
|
|
|
|
|
|
|
|
|
self
|
|
|
|
self
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -30,11 +30,11 @@ impl PaccacheBuilder {
|
|
|
|
pub async fn remove(self) -> AppResult<()> {
|
|
|
|
pub async fn remove(self) -> AppResult<()> {
|
|
|
|
let mut command = ShellCommand::paccache().elevated();
|
|
|
|
let mut command = ShellCommand::paccache().elevated();
|
|
|
|
|
|
|
|
|
|
|
|
if self.quiet {
|
|
|
|
if self.quiet_output {
|
|
|
|
command = command.arg("-q");
|
|
|
|
command = command.arg("-q");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if self.keep_ins {
|
|
|
|
if self.keep_ins_pkgs {
|
|
|
|
command = command.arg("-u")
|
|
|
|
command = command.arg("-u")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|