From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.8 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD shortcircuit=no autolearn=ham autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id 5BE531F9AF for ; Fri, 3 Feb 2017 11:02:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753140AbdBCLCg convert rfc822-to-8bit (ORCPT ); Fri, 3 Feb 2017 06:02:36 -0500 Received: from zimbra-vnc.tngtech.com ([83.144.240.98]:59369 "EHLO proxy.tng.vnc.biz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752219AbdBCLC0 (ORCPT ); Fri, 3 Feb 2017 06:02:26 -0500 Received: from localhost (localhost [127.0.0.1]) by proxy.tng.vnc.biz (Postfix) with ESMTP id A6F141E3844; Fri, 3 Feb 2017 12:02:22 +0100 (CET) Received: from proxy.tng.vnc.biz ([127.0.0.1]) by localhost (proxy.tng.vnc.biz [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id CB5rNazNi6fS; Fri, 3 Feb 2017 12:02:22 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by proxy.tng.vnc.biz (Postfix) with ESMTP id 4590A1E3853; Fri, 3 Feb 2017 12:02:22 +0100 (CET) X-Virus-Scanned: amavisd-new at Received: from proxy.tng.vnc.biz ([127.0.0.1]) by localhost (proxy.tng.vnc.biz [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id IAP8Pa2ODmq2; Fri, 3 Feb 2017 12:02:22 +0100 (CET) Received: from localhost.localdomain (46.128.140.114.dynamic.cablesurf.de [46.128.140.114]) by proxy.tng.vnc.biz (Postfix) with ESMTPSA id E01911E3850; Fri, 3 Feb 2017 12:02:21 +0100 (CET) From: cornelius.weig@tngtech.com To: git@vger.kernel.org Cc: szeder.dev@gmail.com, j6t@kdbg.org, Cornelius Weig Subject: [PATCH v2 6/7] completion: teach remote subcommands to complete options Date: Fri, 3 Feb 2017 12:01:58 +0100 Message-Id: <20170203110159.377-7-cornelius.weig@tngtech.com> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20170203110159.377-1-cornelius.weig@tngtech.com> References: <20170203110159.377-1-cornelius.weig@tngtech.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org From: Cornelius Weig Git-remote needs to complete remote names, its subcommands, and options thereof. In addition to the existing subcommand and remote name completion, do also complete the options - add: --track --master --fetch --tags --no-tags --mirror= - set-url: --push --add --delete - get-url: --push --all - prune: --dry-run Signed-off-by: Cornelius Weig Reviewed-by: SZEDER Gábor --- contrib/completion/git-completion.bash | 45 ++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash index 4841036..d8960cf 100644 --- a/contrib/completion/git-completion.bash +++ b/contrib/completion/git-completion.bash @@ -2384,24 +2384,55 @@ _git_config () _git_remote () { - local subcommands="add rename remove set-head set-branches set-url show prune update" + local subcommands=" + add rename remove set-head set-branches + get-url set-url show prune update + " local subcommand="$(__git_find_on_cmdline "$subcommands")" if [ -z "$subcommand" ]; then - __gitcomp "$subcommands" + case "$cur" in + --*) + __gitcomp "--verbose" + ;; + *) + __gitcomp "$subcommands" + ;; + esac return fi - case "$subcommand" in - rename|remove|set-url|show|prune) - __gitcomp_nl "$(__git_remotes)" + case "$subcommand,$cur" in + add,--*) + __gitcomp "--track --master --fetch --tags --no-tags --mirror=" + ;; + add,*) + ;; + set-head,--*) + __gitcomp "--auto --delete" ;; - set-head|set-branches) + set-branches,--*) + __gitcomp "--add" + ;; + set-head,*|set-branches,*) __git_complete_remote_or_refspec ;; - update) + update,--*) + __gitcomp "--prune" + ;; + update,*) __gitcomp "$(__git_get_config_variables "remotes")" ;; + set-url,--*) + __gitcomp "--push --add --delete" + ;; + get-url,--*) + __gitcomp "--push --all" + ;; + prune,--*) + __gitcomp "--dry-run" + ;; *) + __gitcomp_nl "$(__git_remotes)" ;; esac } -- 2.10.2