From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by arlo.cworth.org (Postfix) with ESMTP id 6FCF36DE02DA for ; Sun, 23 Oct 2016 11:41:38 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at cworth.org X-Spam-Flag: NO X-Spam-Score: -0.226 X-Spam-Level: X-Spam-Status: No, score=-0.226 tagged_above=-999 required=5 tests=[AWL=-0.206, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01] autolearn=disabled Received: from arlo.cworth.org ([127.0.0.1]) by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IBuFHYUbFN2W for ; Sun, 23 Oct 2016 11:41:36 -0700 (PDT) Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by arlo.cworth.org (Postfix) with ESMTPS id 55D1F6DE02BF for ; Sun, 23 Oct 2016 11:41:36 -0700 (PDT) Received: by mail-lf0-f68.google.com with SMTP id x23so9171956lfi.1 for ; Sun, 23 Oct 2016 11:41:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nikula-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZQBOLz8UrCtNZqvAu/3mRR68i7/Ek6AQHBHJZ6aUFwI=; b=Z2VvpjovEEQA7YLen7RDdvZZ0PUNaBR58RLMK7Qa1ydECMQDuG5fg7Dg+XdEGhIhX7 57TeJCFn5N4e5gnu3G1YyrsQ97ed0wo5FdqRAKsVnp5rWBBaU2kZCkR8OvxAN6wqIntk sHiyIEwK0XoNjFcuOYSFM02NNO95cD99B3MFAtLj742AiIgcBRndYfAiH2pjLZB9bqeP 6d+RW/1jq5OQKNpfNqQyx91JQDRsJ1aHXz2fXBkDne72mLB7rgZ3UGm26ZWCgAvhXGho Asib1lciNLANlz1RALWysBWiwQ3JmkXgb1qKC5zHDuBuqP463jt4WORl/ayl4sagXZ2r a1Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZQBOLz8UrCtNZqvAu/3mRR68i7/Ek6AQHBHJZ6aUFwI=; b=XNvCxOXgkxLfkXSetHQeQa9Yd11GIFTlx+tGnmrJFX1q1s4utBmBRItazmF2YdtueJ zTp1NKdAk9WYupkr5sn99W85wk1Mr2V7mD678emP4SoO1hI+OWoFn6DIT5VlsLCbgkte GhBoqkFeBPQTQicWhe6olTUzqwO5xd/WcYHlK6W7kiTveFEPlIjhr4Pb1bEt2aJSb9DA 9tIWLePHOnqLBVHYya3ZN68wNIKhRDVxCizJshaOPDy9+1CAafYqtWYvAEiLH9XZIcuc ZEQgUrD4fIv9GuVU5q7R7GnFami1gNtVCLTaP4Rz+ur3SzDPvx4FrSEgm1f7KOhbmp7C 3MMA== X-Gm-Message-State: ABUngveuVP2GNRUxnde9kyXUx1YxIP4tiIhrhVY7ZBuXDiKie6T4jGgZxg91s4OCtGFfRQ== X-Received: by 10.25.134.133 with SMTP id i127mr5474325lfd.102.1477248094096; Sun, 23 Oct 2016 11:41:34 -0700 (PDT) Received: from localhost (mobile-access-bceef0-89.dhcp.inet.fi. [188.238.240.89]) by smtp.gmail.com with ESMTPSA id j137sm2333027lfj.40.2016.10.23.11.41.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 23 Oct 2016 11:41:33 -0700 (PDT) From: Jani Nikula To: notmuch@notmuchmail.org Subject: [PATCH v2] completion: complete mimetype: search prefix Date: Sun, 23 Oct 2016 21:39:42 +0300 Message-Id: <1477247982-28075-1-git-send-email-jani@nikula.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1477162534-7814-1-git-send-email-jani@nikula.org> References: <1477162534-7814-1-git-send-email-jani@nikula.org> X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Oct 2016 18:41:38 -0000 Use /etc/mime.types if available, with a homebrew sed parser, and fall back to a handful of common types otherwise. --- v2: smarter sed thanks to Lucas Hoffmann --- completion/notmuch-completion.bash | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash index 78047b5f424d..e7e7d68b04ed 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 '/^[^ \t#]/{s/[ \t].*//;p;}' < /etc/mime.types + else + cat <