Use rg if it's present in bin/replace
I like this `bin/replace` script, but I've recently switched from `ag` to [ripgrep](https://github.com/BurntSushi/ripgrep). This checks for the presence of `rg` and uses it in `bin/replace`, passing the correct parameter to disable colors.
This commit is contained in:
parent
013f9711af
commit
b132c644be
1 changed files with 6 additions and 1 deletions
|
@ -9,7 +9,12 @@ shift
|
||||||
replace_with="$1"
|
replace_with="$1"
|
||||||
shift
|
shift
|
||||||
|
|
||||||
items=$(ag -l --nocolor "$find_this" "$@")
|
if which rg &>/dev/null ; then
|
||||||
|
items=$(rg -l --color never "$find_this" "$@")
|
||||||
|
else
|
||||||
|
items=$(ag -l --nocolor "$find_this" "$@")
|
||||||
|
fi
|
||||||
|
|
||||||
temp="${TMPDIR:-/tmp}/replace_temp_file.$$"
|
temp="${TMPDIR:-/tmp}/replace_temp_file.$$"
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for item in $items; do
|
for item in $items; do
|
||||||
|
|
Loading…
Add table
Reference in a new issue