mirror of https://github.com/leahneukirchen/mblaze
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
46 lines
696 B
Bash
46 lines
696 B
Bash
#!/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
|
|
;;
|
|
x)
|
|
engine=mairix
|
|
;;
|
|
'?')
|
|
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 "$@"
|
|
;;
|
|
mairix)
|
|
if [ "$#" -eq 0 ]; then
|
|
printf "Usage: %s -x query\n" "$0" 1>&2
|
|
exit 1
|
|
fi
|
|
exec mairix -r "$@"
|
|
;;
|
|
*)
|
|
echo "Unsupported search engine: $engine"
|
|
exit 1
|
|
;;
|
|
esac
|