--- /dev/null
+Return-Path: <jani@nikula.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+ by arlo.cworth.org (Postfix) with ESMTP id AEDE96DE0AC2\r
+ for <notmuch@notmuchmail.org>; Sat, 17 Oct 2015 09:30:36 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.538\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.538 tagged_above=-999 required=5 tests=[AWL=0.182,\r
+ RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id pIScXEeaipes for <notmuch@notmuchmail.org>;\r
+ Sat, 17 Oct 2015 09:30:35 -0700 (PDT)\r
+Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com\r
+ [209.85.212.178])\r
+ by arlo.cworth.org (Postfix) with ESMTPS id 9B9B76DE0943\r
+ for <notmuch@notmuchmail.org>; Sat, 17 Oct 2015 09:30:34 -0700 (PDT)\r
+Received: by wicgb1 with SMTP id gb1so43564227wic.1\r
+ for <notmuch@notmuchmail.org>; Sat, 17 Oct 2015 09:30:33 -0700 (PDT)\r
+X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
+ d=1e100.net; s=20130820;\r
+ h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\r
+ :references;\r
+ bh=UqRkIcwSLzpeglkLeF7BaRZfcBY5jQqHnvHuRPkd8VI=;\r
+ b=NMEDk+/NmCT7saD9zj8WW2nYaiTvuYursmLhUNW9WyxcV5HsQn05UoP/7r9WlDej5w\r
+ nF1fuPogMi9l7Zs55CcyF4hmO+wL2NCOLknzd16vmpWWnIUiZk/yqwELeUSiou5Eiq4w\r
+ 3F00QB8Rij1s9eGW5Wes3BI4GwEuCDISZFUf+DIRdT3XQ0mKRHAGC9Y5/zxOgCOhDF0C\r
+ FTxw9uUTSGyriDPfc3Dow17Mc5KjhNOJZsDiNFxjcEiQnG5GqkSZGM+bCdGf6rz81S0j\r
+ geB4b/1TEOUtbB17l+G07yb7X6mfXtM9gNDaGug8O1cmWRKifN0hHE/0Qru1X9xNt5uL\r
+ 3iLw==\r
+X-Gm-Message-State:\r
+ ALoCoQnu9JA6/hsKKr1OZpKR5nLoQtxo64aPOEpWygRd8OEaJ04Rr+Ggq3Y6686X3Gc5AhVpx4oz\r
+X-Received: by 10.180.90.37 with SMTP id bt5mr11363839wib.7.1445099433112;\r
+ Sat, 17 Oct 2015 09:30:33 -0700 (PDT)\r
+Received: from localhost (mobile-access-bcee43-111.dhcp.inet.fi.\r
+ [188.238.67.111])\r
+ by smtp.gmail.com with ESMTPSA id ew2sm7650249wic.20.2015.10.17.09.30.32\r
+ (version=TLSv1/SSLv3 cipher=OTHER);\r
+ Sat, 17 Oct 2015 09:30:32 -0700 (PDT)\r
+From: Jani Nikula <jani@nikula.org>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 2/3] completion: complete shared options for each command\r
+Date: Sat, 17 Oct 2015 19:30:02 +0300\r
+Message-Id: <1445099403-25998-2-git-send-email-jani@nikula.org>\r
+X-Mailer: git-send-email 2.1.4\r
+In-Reply-To: <1445099403-25998-1-git-send-email-jani@nikula.org>\r
+References: <1443265970-9875-1-git-send-email-jani@nikula.org>\r
+ <1445099403-25998-1-git-send-email-jani@nikula.org>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+ <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch/>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+ <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 17 Oct 2015 16:30:36 -0000\r
+\r
+Add support for completing --help, --uuid=, and --version after the\r
+subcommand. Do not support shared options at the top level yet due to\r
+difficulties in handling options with arguments.\r
+\r
+--uuid necessitates adding 'compopt -o nospace' also to notmuch new\r
+completion, but that just brings it in line with the rest.\r
+---\r
+ completion/notmuch-completion.bash | 25 ++++++++++++++-----------\r
+ 1 file changed, 14 insertions(+), 11 deletions(-)\r
+\r
+diff --git a/completion/notmuch-completion.bash b/completion/notmuch-completion.bash\r
+index 1552c1e51db7..1356c4a40515 100644\r
+--- a/completion/notmuch-completion.bash\r
++++ b/completion/notmuch-completion.bash\r
+@@ -27,6 +27,8 @@\r
+ # on completion.\r
+ #\r
+ \r
++_notmuch_shared_options="--help --uuid= --version"\r
++\r
+ # $1: current input of the form prefix:partialinput, where prefix is\r
+ # to or from.\r
+ _notmuch_email()\r
+@@ -109,7 +111,7 @@ _notmuch_compact()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--backup= --quiet"\r
++ local options="--backup= --quiet ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -162,7 +164,7 @@ _notmuch_count()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--output= --exclude= --batch --input= --lastmod"\r
++ local options="--output= --exclude= --batch --input= --lastmod ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -192,7 +194,7 @@ _notmuch_dump()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--gzip --format= --output="\r
++ local options="--gzip --format= --output= ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -222,7 +224,7 @@ _notmuch_insert()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ --*)\r
+- local options="--create-folder --folder= --keep --no-hooks"\r
++ local options="--create-folder --folder= --keep --no-hooks ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ return\r
+@@ -245,7 +247,8 @@ _notmuch_new()\r
+ \r
+ case "${cur}" in\r
+ -*)\r
+- local options="--no-hooks --quiet"\r
++ local options="--no-hooks --quiet ${_notmuch_shared_options}"\r
++ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "${options}" -- ${cur}) )\r
+ ;;\r
+ esac\r
+@@ -271,7 +274,7 @@ _notmuch_reply()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--format= --format-version= --reply-to= --decrypt"\r
++ local options="--format= --format-version= --reply-to= --decrypt ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -301,7 +304,7 @@ _notmuch_restore()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--format= --accumulate --input="\r
++ local options="--format= --accumulate --input= ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -336,7 +339,7 @@ _notmuch_search()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--format= --output= --sort= --offset= --limit= --exclude= --duplicate="\r
++ local options="--format= --output= --sort= --offset= --limit= --exclude= --duplicate= ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -378,7 +381,7 @@ _notmuch_address()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--format= --output= --sort= --exclude= --deduplicate="\r
++ local options="--format= --output= --sort= --exclude= --deduplicate= ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -412,7 +415,7 @@ _notmuch_show()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ -*)\r
+- local options="--entire-thread= --format= --exclude= --body= --format-version= --part= --verify --decrypt --include-html"\r
++ local options="--entire-thread= --format= --exclude= --body= --format-version= --part= --verify --decrypt --include-html ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ ;;\r
+@@ -439,7 +442,7 @@ _notmuch_tag()\r
+ ! $split &&\r
+ case "${cur}" in\r
+ --*)\r
+- local options="--batch --input= --remove-all"\r
++ local options="--batch --input= --remove-all ${_notmuch_shared_options}"\r
+ compopt -o nospace\r
+ COMPREPLY=( $(compgen -W "$options" -- ${cur}) )\r
+ return\r
+-- \r
+2.1.4\r
+\r