Skip to content

Commit

Permalink
ripgrep.bash: fail if no ripgrep
Browse files Browse the repository at this point in the history
  • Loading branch information
balupton committed Sep 1, 2023
1 parent 23d187a commit 235e520
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion commands/brew
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function brew() (
# get the homebrew binary
local bin="${HOMEBREW_PREFIX-}/bin/brew"
if test ! -x "$bin"; then
echo-style --error='Homebrew is not installed.' ' ' --notice="Install it with:" ' ' --code='setup-mac-brew' >/dev/stderr
echo-style --error='Homebrew is not installed.' ' ' --notice='Install it with:' ' ' --code='setup-mac-brew' >/dev/stderr
# ^ don't use get-installer, as bash v5 may not exist yet
return 74 # EPROGUNAVAIL 74 RPC prog. not avail
fi
Expand Down
4 changes: 4 additions & 0 deletions sources/ripgrep.bash
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ if test -z "${RIPGREP_BIN_PATH-}"; then
function rg {
local ripgrep_bin_path
ripgrep_bin_path="$(type -P rg)"
if test -z "$ripgrep_bin_path"; then
echo-style --error='ripgrep is required to continue, and was not able to be auto-installed.' ' ' --notice='Install it with:' ' ' --code='setup-util-ripgrep' >/dev/stderr
return 74 # EPROGUNAVAIL 74 RPC prog. not avail
fi
"$ripgrep_bin_path" --no-line-number --color never "$@"
}
fi

0 comments on commit 235e520

Please sign in to comment.