zsh-workers
 help / color / mirror / code / Atom feed
* Advantages of using _argument states
@ 2006-11-14 21:29 Nikolai Weibull
  2006-11-15 10:27 ` Peter Stephenson
  0 siblings, 1 reply; 2+ messages in thread
From: Nikolai Weibull @ 2006-11-14 21:29 UTC (permalink / raw)
  To: Zsh hackers list

What are the advantages and disadvantages of using _argument states
over writing functions that generate the matches, i.e,

  '*-chmod[change mode of file]:mode:->modes'

versus

 '*-chmod[change mode of file]:mode:_modes'

(or perhaps __modes to not clutter the Type-completion namespace)?

As far as I can tell, the only difference (and an obvious one at that)
is that states result in a big case-statement but you avoid extra
functions, whereas writing a function adds an extra function, but
saves us from the big case-statement.

I've gone over the documentation a bunch of times and I've been
looking through completion definitions without seeing any point to
using states over functions.

Am I correct in my assessment that they're basically two ways of doing
the same thing and the difference between them is the one I wrote
about above?

Also, writing a function makes it easier to turn that into a Type
completion later on, if need be.

(By the way, I'm writing a completion definition for mkisofs and growisofs.)

Thanks!

  nikolai


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

end of thread, other threads:[~2006-11-15 10:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-11-14 21:29 Advantages of using _argument states Nikolai Weibull
2006-11-15 10:27 ` Peter Stephenson

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