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