Skip to content

Commit

Permalink
Adding __homebrew-check check and update to git/system completions
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadassaf committed Mar 7, 2024
1 parent 54525cc commit 3f0987e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components
Submodule components updated 1 files
+1 −1 completions
19 changes: 19 additions & 0 deletions lib/helpers/utils.bash
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,22 @@ _array-dedupe() {

_clean-string "$(echo "$*" | tr ' ' '\n' | sort -u | tr '\n' ' ')" "all"
}

# @function __homebrew-check
# @description check the installation ot homebrew
# @return boolean status code success (0) if the function is found or fails otherwise
function _homebrew-check() {
if _binary_exists 'brew'; then
# Homebrew is installed
if [[ "${GAUDI_BASH_HOMEBREW_PREFIX:-unset}" == 'unset' ]]; then
# variable isn't set
GAUDI_BASH_HOMEBREW_PREFIX="$(brew --prefix)"
else
true # Variable is set already, don't invoke `brew`.
fi
else
# Homebrew is not installed: clear variable.
GAUDI_BASH_HOMEBREW_PREFIX=
false # return failure if brew not installed.
fi
}

0 comments on commit 3f0987e

Please sign in to comment.