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