Skip to content

Commit ed6f2a1

Browse files
committed
Don't install grep on macs
1 parent e3462b5 commit ed6f2a1

4 files changed

Lines changed: 15 additions & 23 deletions

File tree

lib/helpers.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,18 @@ function error_and_proceed() {
207207
};
208208
export -f error_and_proceed;
209209

210+
function check_dependencies() {
211+
if [[ $(uname) == 'Darwin' ]] && [ $(which brew) ]; then
212+
if ! [ $(which ggrep) ]; then
213+
log 'error' 'A metaphysical dichotomy has caused this unit to overload and shut down. GNU Grep is a requirement and your Mac does not have it. Consider "brew install grep"';
214+
fi;
215+
216+
shopt -s expand_aliases;
217+
alias grep=ggrep;
218+
fi;
219+
};
220+
export -f check_dependencies;
221+
210222
source "$TFENV_ROOT/lib/tfenv-exec.sh";
211223
source "$TFENV_ROOT/lib/tfenv-version-file.sh";
212224
source "$TFENV_ROOT/lib/tfenv-version-name.sh";

libexec/tfenv-install

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,7 @@ download_signature() {
194194
# This allows keybase login detection to work on Mac,
195195
# and is required to be able to detect terraform version
196196
# from "required_version" setting in "*.tf" files
197-
if [[ $(uname) == 'Darwin' ]] && [ $(which brew) ]; then
198-
if ! [ $(which ggrep) ]; then
199-
brew install grep;
200-
fi;
201-
202-
shopt -s expand_aliases;
203-
alias grep=ggrep;
204-
fi;
197+
check_dependencies;
205198

206199
# Verify signature if verification mechanism (keybase, gpg, etc) is present
207200
if [[ -f "${TFENV_CONFIG_DIR}/use-gnupg" ]]; then

libexec/tfenv-resolve-version

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,7 @@ done;
6161
# This allows keybase login detection to work on Mac,
6262
# and is required to be able to detect terraform version
6363
# from "required_version" setting in "*.tf" files
64-
if [[ $(uname) == 'Darwin' ]] && [ $(which brew) ]; then
65-
if ! [ $(which ggrep) ]; then
66-
brew install grep;
67-
fi;
68-
shopt -s expand_aliases;
69-
alias grep=ggrep;
70-
fi;
64+
check_dependencies;
7165

7266
#####################
7367
# Begin Script Body #

libexec/tfenv-version-name

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,7 @@ done;
6060
# This allows keybase login detection to work on Mac,
6161
# and is required to be able to detect terraform version
6262
# from "required_version" setting in "*.tf" files
63-
if [[ $(uname) == 'Darwin' ]] && [ $(which brew) ]; then
64-
if ! [ $(which ggrep) ]; then
65-
brew install grep;
66-
fi;
67-
68-
shopt -s expand_aliases;
69-
alias grep=ggrep;
70-
fi;
63+
check_dependencies;
7164

7265
#####################
7366
# Begin Script Body #

0 commit comments

Comments
 (0)