feat(alias-finder): Use ripgrep if possible

- basic grep is too slow for very long command. ripgrep can easily remediate this issue.
This commit is contained in:
Roeniss Moon 2025-03-30 23:16:59 +09:00
commit 25b2c9f37e
No known key found for this signature in database
GPG key ID: 9E9AE088DBD537FB
2 changed files with 10 additions and 4 deletions

View file

@ -43,7 +43,11 @@ alias-finder() {
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
fi
alias | grep -E "$filter" | grep -E "=$finder"
if command -v rg >/dev/null 2>&1; then
alias | rg "$filter" | rg "=$finder"
else
alias | grep -E "$filter" | grep -E "=$finder"
fi
if [[ $exact == true ]]; then
break # because exact case is only one