mblaze/contrib/msearch

46 lines
696 B
Plaintext
Raw Normal View History

#!/bin/sh
MBLAZE=${MBLAZE:-$HOME/.mblaze}
engine=$(mhdr -h search-engine "$MBLAZE/profile")
while getopts nmx opt; do
case $opt in
n)
engine=notmuch
;;
m)
engine=mu
;;
2018-09-27 12:08:18 +00:00
x)
engine=mairix
;;
'?')
2018-09-27 12:10:11 +00:00
printf "Usage: %s: [-n | -m | -x] query\n" "$0" 1>&2
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 "$@"
;;
*)
echo "Unsupported search engine: $engine"
exit 1
;;
esac