git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Cornelius Weig <cornelius.weig@tngtech.com>
Cc: "SZEDER Gábor" <szeder.dev@gmail.com>,
	bitte.keine.werbung.einwerfen@googlemail.com,
	thomas.braun@virtuell-zuhause.de, john@keeping.me.uk,
	git@vger.kernel.org
Subject: Re: [PATCH 6/7] completion: teach remote subcommands option completion
Date: Thu,  2 Feb 2017 02:37:59 +0100	[thread overview]
Message-ID: <20170202013759.25789-1-szeder.dev@gmail.com> (raw)
In-Reply-To: <20170122225724.19360-7-cornelius.weig@tngtech.com>


> 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=

Oh, '--track' and '--master' are not even in the manpage or in 'git
remote -h', I could only find them after looking at the source code...

Good eyes :)

>  - set-url: --push --add --delete
>  - get-url: --push --all
>  - prune: --dry-run
> ---
>  contrib/completion/git-completion.bash | 36 +++++++++++++++++++++++++++-------
>  1 file changed, 29 insertions(+), 7 deletions(-)
> 
> diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
> index e76cbd7..0e09519 100644
> --- a/contrib/completion/git-completion.bash
> +++ b/contrib/completion/git-completion.bash
> @@ -2384,24 +2384,46 @@ _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="
>  		;;
> -	set-head|set-branches)
> +	add,*)
> +		;;
> +	set-head,*|set-branches,*)

The 'set-head' subcommand has '--auto' and '--delete' options, and
'set-branches' has '--add'.

>  		__git_complete_remote_or_refspec
>  		;;
> -	update)
> +	update,*)

The 'update' subcommand has a '--prune' option.

Otherwise it all looks good.


>  		__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



  reply	other threads:[~2017-02-02  1:39 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22 22:57 [PATCH 0/7] completion bash: add more options and commands bitte.keine.werbung.einwerfen
2017-01-22 22:57 ` [PATCH 1/7] completion: teach options to submodule subcommands bitte.keine.werbung.einwerfen
2017-01-22 22:57 ` [PATCH 2/7] completion: add subcommand completion for rerere bitte.keine.werbung.einwerfen
2017-02-02  0:57   ` SZEDER Gábor
2017-02-02  9:16     ` Cornelius Weig
2017-01-22 22:57 ` [PATCH 3/7] completion: improve bash completion for git-add bitte.keine.werbung.einwerfen
2017-01-22 22:57 ` [PATCH 4/7] completion: teach ls-remote to complete options bitte.keine.werbung.einwerfen
2017-02-02  1:40   ` SZEDER Gábor
2017-02-02  9:40     ` Cornelius Weig
2017-02-02 16:57       ` Junio C Hamano
2017-01-22 22:57 ` [PATCH 5/7] completion: teach replace " bitte.keine.werbung.einwerfen
2017-01-22 22:57 ` [PATCH 6/7] completion: teach remote subcommands option completion bitte.keine.werbung.einwerfen
2017-02-02  1:37   ` SZEDER Gábor [this message]
2017-02-02 10:29     ` Cornelius Weig
2017-01-22 22:57 ` [PATCH 7/7] completion: recognize more long-options bitte.keine.werbung.einwerfen
2017-01-24  7:15   ` Johannes Sixt
2017-01-24  8:14     ` Cornelius Weig
2017-01-24 23:24       ` Junio C Hamano
2017-01-24 23:33         ` Cornelius Weig
2017-01-24 23:43           ` Stefan Beller
2017-01-25  0:11             ` Cornelius Weig
2017-01-25  0:21               ` Stefan Beller
2017-01-25  0:43                 ` Cornelius Weig
2017-01-25  0:52                   ` Re: Stefan Beller
2017-01-25  0:54                 ` Re: Linus Torvalds
2017-01-25  1:32                   ` Re: Eric Wong
2017-01-25  6:54                 ` SubmittingPatches: drop temporal reference for PGP signing Philip Oakley
2017-01-25 22:38                   ` Stefan Beller
2017-01-26 13:30                     ` Cornelius Weig
2017-01-26 17:57                       ` Stefan Beller
2017-01-26 18:18                       ` Junio C Hamano
2017-01-26 20:58                         ` Philip Oakley
2017-01-27 10:49                           ` Cornelius Weig
2017-01-27 17:43                             ` Junio C Hamano
2017-01-27 21:17     ` [PATCH v2 0/7] completion: recognize more long-options cornelius.weig
2017-01-27 21:17       ` [PATCH v2 7/7] " cornelius.weig
2017-01-31 22:17         ` SZEDER Gábor
2017-02-01 16:49           ` Cornelius Weig
2017-02-02  2:00             ` SZEDER Gábor
2017-02-02 10:40               ` Cornelius Weig
2017-01-31 22:42 ` [PATCH 3/7] completion: improve bash completion for git-add SZEDER Gábor

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170202013759.25789-1-szeder.dev@gmail.com \
    --to=szeder.dev@gmail.com \
    --cc=bitte.keine.werbung.einwerfen@googlemail.com \
    --cc=cornelius.weig@tngtech.com \
    --cc=git@vger.kernel.org \
    --cc=john@keeping.me.uk \
    --cc=thomas.braun@virtuell-zuhause.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).