mirror of
https://git.notmuchmail.org/git/notmuch
synced 2024-11-28 05:34:11 +01:00
completion: complete mimetype: search prefix
Use /etc/mime.types if available, parsed using a sed one-liner, and fall back to a handful of common types otherwise.
This commit is contained in:
parent
343534d82d
commit
4d486cf94d
1 changed files with 32 additions and 0 deletions
|
@ -58,6 +58,34 @@ _notmuch_email()
|
||||||
sed 's/[^<]*<\([^>]*\)>/\1/' | tr "[:upper:]" "[:lower:]" | sort -u
|
sed 's/[^<]*<\([^>]*\)>/\1/' | tr "[:upper:]" "[:lower:]" | sort -u
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_notmuch_mimetype()
|
||||||
|
{
|
||||||
|
# use mime types from mime-support package if available, and fall
|
||||||
|
# back to a handful of common ones otherwise
|
||||||
|
if [ -r "/etc/mime.types" ]; then
|
||||||
|
sed -n '/^[[:alpha:]]/{s/[[:space:]].*//;p;}' /etc/mime.types
|
||||||
|
else
|
||||||
|
cat <<EOF
|
||||||
|
application/gzip
|
||||||
|
application/msword
|
||||||
|
application/pdf
|
||||||
|
application/zip
|
||||||
|
audio/mpeg
|
||||||
|
audio/ogg
|
||||||
|
image/gif
|
||||||
|
image/jpeg
|
||||||
|
image/png
|
||||||
|
message/rfc822
|
||||||
|
text/calendar
|
||||||
|
text/html
|
||||||
|
text/plain
|
||||||
|
text/vcard
|
||||||
|
text/x-diff
|
||||||
|
text/x-vcalendar
|
||||||
|
EOF
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
_notmuch_search_terms()
|
_notmuch_search_terms()
|
||||||
{
|
{
|
||||||
local cur prev words cword split
|
local cur prev words cword split
|
||||||
|
@ -85,6 +113,10 @@ _notmuch_search_terms()
|
||||||
COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
|
COMPREPLY=( $(compgen -d "$path/${cur##folder:}" | \
|
||||||
sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
|
sed "s|^$path/||" | grep -v "\(^\|/\)\(cur\|new\|tmp\)$" ) )
|
||||||
;;
|
;;
|
||||||
|
mimetype:*)
|
||||||
|
compopt -o nospace
|
||||||
|
COMPREPLY=( $(compgen -P "mimetype:" -W "`_notmuch_mimetype ${cur}`" -- ${cur##mimetype:}) )
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date: lastmod:"
|
local search_terms="from: to: subject: attachment: mimetype: tag: id: thread: folder: path: date: lastmod:"
|
||||||
compopt -o nospace
|
compopt -o nospace
|
||||||
|
|
Loading…
Reference in a new issue