brew autoremove (#6)
Authored-by: Kilian Tyler <kilian@ktyler.me> Approved-by: Thomas Schönauer <t.schoenauer@hgs-wt.at>
This commit is contained in:
@@ -64,6 +64,7 @@
|
|||||||
|
|
||||||
[brew]
|
[brew]
|
||||||
#greedy_cask = true
|
#greedy_cask = true
|
||||||
|
#autoremove = true
|
||||||
|
|
||||||
[linux]
|
[linux]
|
||||||
# Arch Package Manager to use. Allowed values: autodetect, trizen, paru, yay, pikaur, pacman, pamac.
|
# Arch Package Manager to use. Allowed values: autodetect, trizen, paru, yay, pikaur, pacman, pamac.
|
||||||
|
|||||||
@@ -202,6 +202,7 @@ pub struct Flatpak {
|
|||||||
#[serde(deny_unknown_fields)]
|
#[serde(deny_unknown_fields)]
|
||||||
pub struct Brew {
|
pub struct Brew {
|
||||||
greedy_cask: Option<bool>,
|
greedy_cask: Option<bool>,
|
||||||
|
autoremove: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Deserialize, Clone, Copy)]
|
#[derive(Debug, Deserialize, Clone, Copy)]
|
||||||
@@ -668,6 +669,15 @@ impl Config {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Whether Brew should autoremove
|
||||||
|
pub fn brew_autoremove(&self) -> bool {
|
||||||
|
self.config_file
|
||||||
|
.brew
|
||||||
|
.as_ref()
|
||||||
|
.and_then(|c| c.autoremove)
|
||||||
|
.unwrap_or(false)
|
||||||
|
}
|
||||||
|
|
||||||
/// Whether Composer should update itself
|
/// Whether Composer should update itself
|
||||||
pub fn composer_self_update(&self) -> bool {
|
pub fn composer_self_update(&self) -> bool {
|
||||||
self.config_file
|
self.config_file
|
||||||
|
|||||||
@@ -210,6 +210,10 @@ pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<
|
|||||||
variant.execute(run_type).arg("cleanup").check_run()?;
|
variant.execute(run_type).arg("cleanup").check_run()?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.config().brew_autoremove() {
|
||||||
|
variant.execute(run_type).arg("autoremove").check_run()?;
|
||||||
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user