git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] complete: zsh: add missing sub cmd completion candidates
@ 2020-04-17  7:11 Terry via GitGitGadget
  2020-04-17 18:24 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Terry via GitGitGadget @ 2020-04-17  7:11 UTC (permalink / raw)
  To: git; +Cc: Terry, Terry Moschou

From: Terry Moschou <tmoschou@gmail.com>

Add missing 'restore' and 'switch' sub commands to zsh completion
candidate output. E.g.

  $ git re<tab>
  rebase    -- forward-port local commits to the updated upstream head
  reset     -- reset current HEAD to the specified state
  restore   -- restore working tree files

  $ git s<tab>
  show      -- show various types of objects
  status    -- show the working tree status
  switch    -- switch branches

Signed-off-by: Terry Moschou <tmoschou@gmail.com>
---
    complete: zsh: add missing sub cmd completion candidates
    
    Add missing 'restore' and 'switch' sub commands to zsh completion
    candidate output. E.g.
    
    $ git re<tab>
    rebase    -- forward-port local commits to the updated upstream head
    reset     -- reset current HEAD to the specified state
    restore   -- restore working tree files
    
    $ git s<tab>
    show      -- show various types of objects
    status    -- show the working tree status
    switch    -- switch branches
    
    Signed-off-by: Terry Moschou tmoschou@gmail.com [tmoschou@gmail.com]

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-613%2Ftmoschou%2Fupdate-zsh-completion-script-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-613/tmoschou/update-zsh-completion-script-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/613

 contrib/completion/git-completion.zsh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index eef4eff53df..ce47e86b60c 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -150,9 +150,11 @@ __git_zsh_cmd_common ()
 	push:'update remote refs along with associated objects'
 	rebase:'forward-port local commits to the updated upstream head'
 	reset:'reset current HEAD to the specified state'
+	restore:'restore working tree files'
 	rm:'remove files from the working tree and from the index'
 	show:'show various types of objects'
 	status:'show the working tree status'
+	switch:'switch branches'
 	tag:'create, list, delete or verify a tag object signed with GPG')
 	_describe -t common-commands 'common commands' list && _ret=0
 }

base-commit: de49261b050d9cd8ec73842356077bc5b606640f
-- 
gitgitgadget

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] complete: zsh: add missing sub cmd completion candidates
  2020-04-17  7:11 [PATCH] complete: zsh: add missing sub cmd completion candidates Terry via GitGitGadget
@ 2020-04-17 18:24 ` Junio C Hamano
  2020-10-25  3:35   ` Felipe Contreras
  0 siblings, 1 reply; 3+ messages in thread
From: Junio C Hamano @ 2020-04-17 18:24 UTC (permalink / raw)
  To: Terry via GitGitGadget; +Cc: git, Terry

"Terry via GitGitGadget" <gitgitgadget@gmail.com> writes:

> diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
> index eef4eff53df..ce47e86b60c 100644
> --- a/contrib/completion/git-completion.zsh
> +++ b/contrib/completion/git-completion.zsh
> @@ -150,9 +150,11 @@ __git_zsh_cmd_common ()
>  	push:'update remote refs along with associated objects'
>  	rebase:'forward-port local commits to the updated upstream head'
>  	reset:'reset current HEAD to the specified state'
> +	restore:'restore working tree files'
>  	rm:'remove files from the working tree and from the index'
>  	show:'show various types of objects'
>  	status:'show the working tree status'
> +	switch:'switch branches'
>  	tag:'create, list, delete or verify a tag object signed with GPG')
>  	_describe -t common-commands 'common commands' list && _ret=0
>  }

This is not a new issue, but it makes me wonder if we can initialize
this list just once by running "git help" and picking up pieces from
it.  That way, we won't have to maintain this hardcoded list at all,
no?

And if it is cumbersome to parse "git help" output, I do not think
it is a worse solution than having to maintain the above list
manually to add a new "--list-common-commands-for-zsh-completion"
option to "git help" to produce something more easily parseable.

In any case, the patch is probably an improvement to make the list
closer to what "git help" considers "common commands", but in the
longer term, it may not be making it any better for maintainability.

Thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] complete: zsh: add missing sub cmd completion candidates
  2020-04-17 18:24 ` Junio C Hamano
@ 2020-10-25  3:35   ` Felipe Contreras
  0 siblings, 0 replies; 3+ messages in thread
From: Felipe Contreras @ 2020-10-25  3:35 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Terry via GitGitGadget, Git, Terry

On Fri, Apr 17, 2020 at 1:26 PM Junio C Hamano <gitster@pobox.com> wrote:

> This is not a new issue, but it makes me wonder if we can initialize
> this list just once by running "git help" and picking up pieces from
> it.  That way, we won't have to maintain this hardcoded list at all,
> no?

Yes, that would be nice, but what if the user has an older version of
git without --list-cmds? No solution has been proposed for those cases
in the bash script.

Most users of the zsh script are decoupled from the corresponding git
version, and since you refused to graduate the scripts out of contrib,
that gives distro maintainers the excuse not to automatically package
the zsh script.

So no, given the current situation, I would rather keep updating them manually.

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-25  3:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-17  7:11 [PATCH] complete: zsh: add missing sub cmd completion candidates Terry via GitGitGadget
2020-04-17 18:24 ` Junio C Hamano
2020-10-25  3:35   ` Felipe Contreras

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).