2018-09-26 20:57:57 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
MBLAZE=${MBLAZE:-$HOME/.mblaze}
|
|
|
|
engine=$(mhdr -h search-engine "$MBLAZE/profile")
|
|
|
|
|
2018-09-27 12:08:48 +00:00
|
|
|
while getopts nmx opt; do
|
2018-09-26 20:57:57 +00:00
|
|
|
case $opt in
|
|
|
|
n)
|
|
|
|
engine=notmuch
|
|
|
|
;;
|
|
|
|
m)
|
|
|
|
engine=mu
|
|
|
|
;;
|
2018-09-27 12:08:18 +00:00
|
|
|
x)
|
|
|
|
engine=mairix
|
|
|
|
;;
|
2018-09-26 20:57:57 +00:00
|
|
|
'?')
|
2018-09-27 12:10:11 +00:00
|
|
|
printf "Usage: %s: [-n | -m | -x] query\n" "$0" 1>&2
|
2018-09-26 20:57:57 +00:00
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
shift $(($OPTIND - 1))
|
|
|
|
|
|
|
|
[ -z "$engine" ] && engine=notmuch
|
|
|
|
|
|
|
|
case $engine in
|
|
|
|
notmuch)
|
|
|
|
exec notmuch search --output=files "$@"
|
|
|
|
;;
|
|
|
|
mu)
|
|
|
|
exec mu find --fields l "$@"
|
|
|
|
;;
|
2018-09-27 12:08:18 +00:00
|
|
|
mairix)
|
|
|
|
if [ "$#" -eq 0 ]; then
|
2018-09-27 12:10:11 +00:00
|
|
|
printf "Usage: %s -x query\n" "$0" 1>&2
|
2018-09-27 12:08:18 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
exec mairix -r "$@"
|
|
|
|
;;
|
2018-09-26 20:57:57 +00:00
|
|
|
*)
|
|
|
|
echo "Unsupported search engine: $engine"
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
esac
|