From: Jani Nikula Date: Wed, 2 Nov 2016 18:46:47 +0000 (+0200) Subject: completion: complete mimetype: search prefix X-Git-Tag: 0.24_rc0~95 X-Git-Url: https://git.cworth.org/git?p=notmuch;a=commitdiff_plain;h=4d486cf94d3fcfe4f07daf7dc65c9de04c7cfdd5 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. --- diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash index 78047b5f..d44b2a28 100644 --- a/completion/notmuch-completion.bash +++ b/completion/notmuch-completion.bash @@ -58,6 +58,34 @@ _notmuch_email() 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 <