zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] complete two or more options for zsh
@ 2015-09-19 19:27 Jun T.
  2015-09-23  5:39 ` Bart Schaefer
  0 siblings, 1 reply; 7+ messages in thread
From: Jun T. @ 2015-09-19 19:27 UTC (permalink / raw)
  To: zsh-workers


% zsh -<TAB>

This offers zsh's options, but the following does not work:

% zsh -v -<TAB>

Here, -v can be any other option.

The reason seems to be that all the optspecs generated by
  _argument -- '*:'   (_sh: line 24)
look like
  -v[equivalent to --verbose]:   --aliases:   etc.
i.e., a ':' is appended to their ends (so the option requires
an argument).

This ':' is added by
  cache+=( "${(@)^tmp}${descr}" )   (_arguments: line 282)
where $descr is equal to ':', which comes from the helpspec '*:'
passed to _arguments. 

Not specifying a helpspec at all seems to fix the problem.
Or using '*' or '*: :  ' as a helpspec seems to work as well.

BTW, the description of _arguments in zshcompsys manpage says:

  The special
  case of `*:' means both message and action are empty, which  has
  the  effect of causing options having no description in the help
  output to be ordered in listings ahead of options  that  have  a
  description.

But even with '*:' options without description are listed after
those with description (and it has a side effect that ':' is appended
to the generated optspecs). Are there any ways to control the order
of listing?


diff --git a/Completion/Unix/Command/_sh b/Completion/Unix/Command/_sh
index 21ebfc3..1b51122 100644
--- a/Completion/Unix/Command/_sh
+++ b/Completion/Unix/Command/_sh
@@ -24,6 +24,6 @@ fi
 
 local ret=$?
 
-[[ $service == zsh ]] && _arguments -S -s -- '*:' && ret=0
+[[ $service == zsh ]] && _arguments -S -s -- && ret=0
 
 return ret





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

end of thread, other threads:[~2015-10-01 10:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-19 19:27 [PATCH] complete two or more options for zsh Jun T.
2015-09-23  5:39 ` Bart Schaefer
2015-09-25 16:04   ` Jun T.
2015-09-25 17:03     ` Bart Schaefer
2015-09-30 16:03       ` Jun T.
2015-09-30 16:19         ` Bart Schaefer
2015-10-01 10:41           ` Jun T.

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