]> git.ipfire.org Git - thirdparty/git.git/commitdiff
completion: zsh: improve command tags
authorFelipe Contreras <felipe.contreras@gmail.com>
Wed, 28 Oct 2020 02:07:05 +0000 (20:07 -0600)
committerJunio C Hamano <gitster@pobox.com>
Wed, 28 Oct 2020 21:30:59 +0000 (14:30 -0700)
There's no need to use _alternative and repeat a lot of the code.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.zsh

index 858864f3fb049cc678088d7909e2e11c6287ebd4..22d8e58fccebc6c1d073d3c5ce31d1aa6bc5c773 100644 (file)
@@ -235,10 +235,13 @@ __git_zsh_main ()
 
        case $state in
        (command)
-               _alternative \
-                         'alias-commands:alias:__git_zsh_cmd_alias' \
-                         'common-commands:common:__git_zsh_cmd_common' \
-                         'all-commands:all:__git_zsh_cmd_all' && _ret=0
+               _tags common-commands alias-commands all-commands
+               while _tags; do
+                       _requested common-commands && __git_zsh_cmd_common
+                       _requested alias-commands && __git_zsh_cmd_alias
+                       _requested all-commands && __git_zsh_cmd_all
+                       let _ret || break
+               done
                ;;
        (arg)
                local command="${words[1]}" __git_dir