[PATCH v2] completion: complete mimetype: search prefix

Jani Nikula jani at nikula.org
Sun Oct 30 02:52:11 PDT 2016


On Tue, 25 Oct 2016, Tomi Ollila <domo141 at gmail.com> wrote:
> Jani Nikula <jani at nikula.org> writes:
>
>> Use /etc/mime.types if available, with a homebrew sed parser, and fall
>> back to a handful of common types otherwise.
>
> I'd suggest the following line:
>
> 	sed -n '/^[[:alpha:]]/ s/[[:space:]].*//p' /etc/mime.types
>
> I tested the sed expression works on Linux and Darwin (macOS sierra).

$ sed --version
sed (GNU sed) 4.2.2

$ sed -n '/^[[:alpha:]]/ s/[[:space:]].*//p' /etc/mime.types | wc -l
411

$ sed -n '/^[^ \t#]/{s/[ \t].*//;p;}' < /etc/mime.types | wc -l
787


BR,
Jani.


More information about the notmuch mailing list