batgrep: Remove hardcoded reference to ripgrep executable

This commit is contained in:
Ethan P 2020-10-28 19:15:48 -07:00
parent 40a66d934d
commit a6a1e55522
No known key found for this signature in database
GPG Key ID: 6963FD04F6CF35EA
2 changed files with 6 additions and 3 deletions

View File

@ -8,10 +8,13 @@
if [[ -z "$__LIB_CONSTANTS_INITIALIZED" ]]; then
__LIB_CONSTANTS_INITIALIZED=true
# Constants
# Constants: Executables
EXECUTABLE_BAT="$(command -v bat 2>/dev/null || command -v batcat 2>/dev/null || echo "bat")"
EXECUTABLE_GIT="git"
EXECUTABLE_DELTA="delta"
EXECUTABLE_RIPGREP="rg"
# Constants: Program
PROGRAM="$(basename "$0" .sh)"
PROGRAM_HOMEPAGE="https://github.com/eth-p/bat-extras"
PROGRAM_COPYRIGHT="Copyright (C) 2019-2020 eth-p | MIT License"

View File

@ -257,10 +257,10 @@ main() {
)
if "$READ_FROM_STDIN"; then
rg "${COMMON_RG_ARGS[@]}" <<< "$STDIN_DATA"
"$EXECUTABLE_RIPGREP" "${COMMON_RG_ARGS[@]}" <<< "$STDIN_DATA"
return $?
else
rg "${COMMON_RG_ARGS[@]}"
"$EXECUTABLE_RIPGREP" "${COMMON_RG_ARGS[@]}"
return $?
fi
}