From 7d6a2a0f949fd50c84d421ad792ab94b3a213373 Mon Sep 17 00:00:00 2001 From: Marley Rae Date: Wed, 31 Jan 2024 18:01:26 -0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20service=20start=20to=20brew?= =?UTF-8?q?=5Finstall;=20update=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- homebrew/brew.config.fish | 4 ++++ homebrew/brew_utils.fish | 9 +++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/homebrew/brew.config.fish b/homebrew/brew.config.fish index 2ff560e..0e6cf16 100644 --- a/homebrew/brew.config.fish +++ b/homebrew/brew.config.fish @@ -1,3 +1,7 @@ #!/usr/bin/env fish set -gx HOMEBREW_NO_ANALYTICS 1 + +if status --is-interactive + eval (/usr/local/Homebrew/bin/brew shellenv fish) +end diff --git a/homebrew/brew_utils.fish b/homebrew/brew_utils.fish index 225ebd3..85b1fcd 100644 --- a/homebrew/brew_utils.fish +++ b/homebrew/brew_utils.fish @@ -30,7 +30,7 @@ end # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -function brew_install -a formula_readable_name formula arguments tap_value +function brew_install -a formula_readable_name formula arguments tap_value service # Check that Homebrew is installed if ! cmd_exists "brew" print_error "$formula_readable_name ('Homebrew' is not installed)" @@ -44,11 +44,16 @@ function brew_install -a formula_readable_name formula arguments tap_value end end + # Determine if a service needs to be started & restarted on login. + if set -q service + set -f service_cmd "&& brew services start $formula" + end + # Install the formula. if brew list "$formula" &>/dev/null print_success "$formula_readable_name" else - execute "brew install $formula $arguments" \ + execute "brew install $formula $arguments $service_cmd" \ "$formula_readable_name" end end