office: Rename mail module to office module
Reflecting the somewhat expanding scope of the module, renamed it to office. Still keeps the old files and setups but also got a new README file.
This commit is contained in:
parent
593628b81d
commit
03684ce29f
27 changed files with 28 additions and 15 deletions
34
office/.local/bin/mail-searchcontacts
Executable file
34
office/.local/bin/mail-searchcontacts
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/usr/bin/env sh
|
||||
# gets known e-mail adresses out of the current notmuch database
|
||||
#
|
||||
# called like `mail-searchcontacts [myadress]`
|
||||
#
|
||||
# where myaddress can be anything that connects mails to their adresses:
|
||||
# if directly found in the 'from': field, it will return those adresses
|
||||
# if no results are returned, it will switch to a more fuzzy search mode
|
||||
# looking through subjects, mail text, and so on for the keywords
|
||||
#
|
||||
# this can be somewhat slow for large mailboxes, in which case you probably
|
||||
# want to turn off fuzzy matching
|
||||
|
||||
searchterm="$1"
|
||||
|
||||
# make search fuzzy if 'fuzzy' is the second arg
|
||||
searchcmd() {
|
||||
if [ -n "$1" ] && [ "$2" = "fuzzy" ]; then
|
||||
term="and $1"
|
||||
elif [ -n "$1" ]; then
|
||||
term="and from:$1"
|
||||
else
|
||||
term=""
|
||||
fi
|
||||
notmuch address --deduplicate=address --output=count not from:marty.oehme@gmail.com "$term" | sort --numeric-sort -r | cut -f2- | sed -e 's/\(^.*\)\(<.*$\)/\2\t\1/'
|
||||
}
|
||||
|
||||
results=$(searchcmd "$searchterm")
|
||||
|
||||
if [ -z "$results" ]; then
|
||||
results=$(searchcmd "$searchterm" "fuzzy")
|
||||
fi
|
||||
|
||||
echo "$results"
|
||||
Loading…
Add table
Add a link
Reference in a new issue