Rewrite rofi finder script using ripgrep

This commit is contained in:
2020-11-25 23:42:48 +01:00
parent a343121a34
commit c7616c3ee4
3 changed files with 6 additions and 29 deletions

View File

@@ -1,28 +0,0 @@
#!/usr/bin/env bash
#PUT THIS FILE IN ~/.local/share/rofi/finder.sh
#USE: rofi -show find -modi find:~/.local/share/rofi/finder.sh
if [ ! -z "$@" ]; then
QUERY=$@
if [[ "$@" == /* ]]; then
if [[ "$@" == *\?\? ]]; then
coproc (xdg-open "${QUERY%\/* \?\?}" >/dev/null 2>&1)
exec 1>&-
exit
else
coproc (xdg-open "$@" >/dev/null 2>&1)
exec 1>&-
exit
fi
elif [[ "$@" == \!\!* ]]; then
echo "Type your search query to find files"
elif [[ "$@" == \?* ]]; then
while read -r line; do
echo "$line" \?\?
done <<<$(fd -t file "${QUERY#\?}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error')
else
fd -t file "${QUERY#!}" $HOME/Documents 2>&1 | grep -v 'Permission denied\|Input/output error'
fi
else
echo "Type your search query to find files"
fi