~matthiasbeyer/imag

ref: v0.10.1 imag/etc/imag-contact-mutt-query-command-helper.sh -rw-r--r-- 510 bytes
0bbe6745Matthias Beyer Add changelog for imag 0.10.1 10 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
#
# A helper script for the mutt query_command
#
# Use
#
#     query_command = "/path/to/this/script %s"
#
# in mutt to search contacts from mutt with imag.
#

# mutt wants a one-line status message before the list of contacts.
echo "Searching with imag ..."
imag contact find "$1" --json | \
jq --raw-output '
    map(.fullname[0] as $FN
    | .email
    | map({email: ., fullname: $FN}))
    | flatten
    | map([.email.address, .fullname, .email.properties.TYPE])
    | .[]
    | @tsv
'