From 235e520c1d077b3c0459b6c2ab7e5a2a66642ef4 Mon Sep 17 00:00:00 2001 From: Benjamin Lupton Date: Fri, 1 Sep 2023 13:45:07 +0800 Subject: [PATCH] ripgrep.bash: fail if no ripgrep --- commands/brew | 2 +- sources/ripgrep.bash | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/brew b/commands/brew index 0b73cb96c..00824a9b2 100755 --- a/commands/brew +++ b/commands/brew @@ -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 diff --git a/sources/ripgrep.bash b/sources/ripgrep.bash index 11fc2438a..6fcece87f 100755 --- a/sources/ripgrep.bash +++ b/sources/ripgrep.bash @@ -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