blob: f2fba84af68188c8b3685187e479d1b113da136f (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
#!/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
|