2018-08-27 13:30:54 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Fuzzy find a file and then check which package owns it
|
|
|
|
|
2018-09-13 15:46:32 -07:00
|
|
|
printHelp() {
|
|
|
|
cat << EOF
|
2018-09-14 10:20:21 -07:00
|
|
|
fqo - fuzzy find a file and then check which package owns it
|
|
|
|
Usage: fqo [-h|--help] [patterns]
|
2018-09-13 15:46:32 -07:00
|
|
|
|
2018-09-14 10:20:21 -07:00
|
|
|
Options:
|
|
|
|
-h show this help page
|
2018-09-13 15:46:32 -07:00
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
2018-09-14 10:20:21 -07:00
|
|
|
while true; do
|
|
|
|
case "${1}" in
|
|
|
|
"-h"|"--help")
|
|
|
|
printHelp
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
-?*)
|
|
|
|
echo "Not an option: ${1}" >&2 && exit 1
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break;
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2018-09-13 15:46:32 -07:00
|
|
|
[[ -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 -
|