zsh-workers
 help / color / mirror / code / Atom feed
From: Daniel Shahaf <d.s@daniel.shahaf.name>
To: zsh-workers@zsh.org
Subject: _arguments sets are order sensitive?
Date: Sun, 25 Oct 2015 18:36:26 +0000	[thread overview]
Message-ID: <20151025183626.GO11372@tarsus.local2> (raw)

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)


                 reply	other threads:[~2015-10-25 18:47 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20151025183626.GO11372@tarsus.local2 \
    --to=d.s@daniel.shahaf.name \
    --cc=zsh-workers@zsh.org \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

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).