Add service start to brew_install; update config

This commit is contained in:
Marley Rae 2024-01-31 18:01:26 -08:00
parent 54745b36fe
commit 7d6a2a0f94
2 changed files with 11 additions and 2 deletions

View file

@ -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

View file

@ -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