37 lines
727 B
Bash
Raw Normal View History

2018-08-27 13:30:54 -07:00
#!/usr/bin/env bash
# Fuzzy find a file and then check which package owns it
printHelp() {
cat << EOF
fqo - fuzzy find a file and then check which package owns it
Usage: fqo [-h|--help] [patterns]
Options:
-h show this help page
EOF
}
while true; do
case "${1}" in
"-h"|"--help")
printHelp
exit
;;
--)
shift
break
;;
-?*)
echo "Not an option: ${1}" >&2 && exit 1
exit
;;
*)
break;
;;
esac
done
[[ -z "${*}" ]] && echo "No patterns specified" && exit 1
2018-08-27 13:30:54 -07:00
locate --all --ignore-case --null -- "${@}" | fzf --read0 --exit-0 --select-1 | pacman -Qo -