builder/paccache: more obvious func/var names

i18n
Fries 2 years ago committed by fries1234
parent 6b90744230
commit 8475af9af8

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

@ -18,7 +18,7 @@ pub struct Config {
pub struct ConfigBase {
pub pacdiff_warn: bool,
pub paccache_keep: i32,
pub paccache_keep_ins: bool,
pub paccache_keep_ins_pkgs: bool,
}
#[derive(Debug, Deserialize, Serialize, Default)]
@ -37,7 +37,7 @@ impl Default for ConfigBase {
Self {
pacdiff_warn: true,
paccache_keep: 0,
paccache_keep_ins: true,
paccache_keep_ins_pkgs: true,
}
}
}

@ -91,9 +91,9 @@ pub async fn clean(options: Options) {
// keeps 0 versions of the package in the cache by default
// keeps installed packages in the cache by default
let result = PaccacheBuilder::default()
.keep(conf.base.paccache_keep)
.keep_ins(conf.base.paccache_keep_ins)
.quiet(quiet)
.set_keep(conf.base.paccache_keep)
.keep_ins_pkgs(conf.base.paccache_keep_ins_pkgs)
.quiet_output(quiet)
.remove()
.await;

Loading…
Cancel
Save