Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

_arguments sets are order sensitive?



Consider this patch, which simply reorders the sets, without any other changes:

[[[
diff --git a/Completion/Unix/Command/_git b/Completion/Unix/Command/_git
index 16c3225..bf1f81c 100644
--- a/Completion/Unix/Command/_git
+++ b/Completion/Unix/Command/_git
@@ -1757,15 +1757,6 @@ _git-tag () {
   fi
 
   _arguments -A '-*' \
-    - creation \
-      '(   -s -u --local-user)-a[create an unsigned, annotated tag]' \
-      '(-a    -u --local-user)-s[create an signed and annotated tag]' \
-      '(-a -s)'{-u,--local-user}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \
-      '-f[replace existing tag]' \
-      '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \
-      $message_opts \
-      ': :__git_tags' \
-      ':: :__git_commits' \
     - deletion \
       '-d[delete tags]' \
       '*:: :__git_ignore_line_inside_arguments __git_tags' \
@@ -1781,7 +1772,16 @@ _git-tag () {
       '::pattern' \
     - verification \
       '-v[verifies gpg signutare of tags]' \
-      '*:: :__git_ignore_line_inside_arguments __git_tags'
+      '*:: :__git_ignore_line_inside_arguments __git_tags' \
+    - creation \
+      '(   -s -u --local-user)-a[create an unsigned, annotated tag]' \
+      '(-a    -u --local-user)-s[create an signed and annotated tag]' \
+      '(-a -s)'{-u,--local-user}'[create a tag, annotated and signed with the given key]: :__git_gpg_secret_keys' \
+      '-f[replace existing tag]' \
+      '--cleanup=[cleanup message]:mode:((verbatim\:"no cleanup" whitespace\:"remove leading and trailing whitespace" strip\:"remove leading and trailing whitespace and comments"))' \
+      $message_opts \
+      ': :__git_tags' \
+      ':: :__git_commits'
 }
 
 (( $+functions[_gitk] )) ||
]]]

The case 'git tag hello <TAB>' is routed to the 'verification' set prior to
the patch and to the 'creation' set after it; that is, it always chooses the
last set.

Shouldn't _arguments be considering all sets eligible at that point?  That is,
it should implicitly do «_alternative [creation] [verification] [deletion]»,
instead of choosing only one of them.

Cheers,

Daniel
(I'm not looking into a fix)



Messages sorted by: Reverse Date, Date, Thread, Author