Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Advantages of using _argument states
- X-seq: zsh-workers 22999
- From: "Nikolai Weibull" <now@xxxxxxxx>
- To: "Zsh hackers list" <zsh-workers@xxxxxxxxxx>
- Subject: Advantages of using _argument states
- Date: Tue, 14 Nov 2006 22:29:45 +0100
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:sender:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition:x-google-sender-auth; b=dYU5QjOKeC35saN6rcTAwKxvQpm151+gntU//B14BqaDoPqoESbbfYpzL/HMvsR+92ecXb0NoKrFDIqWsouo29EwvxTNeMBUE3+qUA6FdVXPmxXhYYUKBB7PxEFEXZtrZqn3pgnqMkSC9a2fBAN+AyxhZQHyAD1U9FFVpOhRUhg=
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- Sender: nikolai.weibull@xxxxxxxxx
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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author