Add helper to find contacts with imag-contact in mutt
This commit is contained in:
parent
08ce39989f
commit
a35ebce73a
1 changed files with 23 additions and 0 deletions
23
etc/imag-contact-mutt-query-command-helper.sh
Normal file
23
etc/imag-contact-mutt-query-command-helper.sh
Normal file
|
@ -0,0 +1,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
|
||||||
|
'
|
Loading…
Reference in a new issue