feat: add fetch_head configuration option into brew (#679)

This commit is contained in:
Wallunen
2024-02-06 10:17:27 +02:00
committed by GitHub
parent 7007e76ab5
commit 77a8b3b7d2
3 changed files with 22 additions and 4 deletions

View File

@@ -254,6 +254,7 @@ pub struct Flatpak {
pub struct Brew {
greedy_cask: Option<bool>,
autoremove: Option<bool>,
fetch_head: Option<bool>,
}
#[derive(Debug, Deserialize, Clone, Copy)]
@@ -1096,6 +1097,15 @@ impl Config {
.unwrap_or(false)
}
/// Whether Brew should upgrade formulae built from the HEAD branch
pub fn brew_fetch_head(&self) -> bool {
self.config_file
.brew
.as_ref()
.and_then(|c| c.fetch_head)
.unwrap_or(false)
}
/// Whether Composer should update itself
pub fn composer_self_update(&self) -> bool {
self.config_file

View File

@@ -285,10 +285,15 @@ pub fn run_brew_formula(ctx: &ExecutionContext, variant: BrewVariant) -> Result<
let run_type = ctx.run_type();
variant.execute(run_type).arg("update").status_checked()?;
variant
.execute(run_type)
.args(["upgrade", "--formula"])
.status_checked()?;
let mut command = variant.execute(run_type);
command.args(["upgrade", "--formula"]);
if ctx.config().brew_fetch_head() {
command.arg("--fetch-HEAD");
}
command.status_checked()?;
if ctx.config().cleanup() {
variant.execute(run_type).arg("cleanup").status_checked()?;