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

grouping in patterns in extended compctl

I'm trying to build completion control for a rather complicated command, and
have run into a snag trying to override the default precedence in the pattern
specification for extended completion (what a sentence!).

Here's what I have so far:

dbobj=(cycle cyclev device file finss gidmap history host job license location m
ediatype osref pool poolacl rack saveacl saveset slot uidmap volacl volalias vol
ume wo woparam xgid xuid)
volparams=(volid volname ansil side flipid nxtid gid uid hostid purdate cerdate
cleandate cleancnt initdate accdate mountcnt expdate length capacity slotid onda
te nxtlocid offdate cyclevid devid casel barcode mode protection brand density n
ote locid mediatypes poolid volstate statedate cycleid cyclename cycv_seq device
 flipansil flipvolname host location mediatype nxtansil nxtlocation nxtvolname p
ool prvansil prvid prvvolname rackname rackid slotname)

compctl -k '(add delete modify query)' \
   -x 'c[-1,add][-1,delete][-1,modify][-1,query]' -k dbobj - \
   'c[-2,add][-2,delete][-2,modify][-2,query] c[-1,volume] s[-] , s[-m_]' -k volparams -- sc

Unfortunately, what need to do with the second pattern set is say:

if two words ago was one of 'add delete modify, or query', and one word ago
was 'volume' and the current word starts with - or -m_, then match with any
of the volparams array.  Unfortunately, the default precedence appears to and
the c[-1,volume] and s[-] before the or'ing of s[-] , s[-m_].  Suggestions?

Also, any suggestions on cleaning this up in general would be appreciated.
This could end up being one of the longest compctl's ever built!  Which brings
up another question:  what's the max length of one of these?

John Harres <harres@xxxxxxxx>        http://horseman.uwyo.edu/~harres
<A HREF="http://www.uwyo.edu";>University of Wyoming</A> 
Finger harres@xxxxxxxxxxxxxxxxx for PGP public key.
Key fingerprint =  FC B4 72 D6 37 A7 A1 73  BE 8B F3 E2 99 68 BF 5A 

Attachment: pgpbMlrISoMuF.pgp
Description: PGP signature

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