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

Compctl long options?



It occurred to me that it might be possible and sensible to extend
compctl to use Posictic long options, as GNU utilities do.  Since only
`--' has a meaning at the moment, it should be possible to parse
`--anything-else' without a clash.  It could even be in a separate
library, with loading triggered by finding something after a `--'.
This is looking more and more helpful after Sven's patches for
grouping.  The internal structures wouldn't need to change, only
initialisation files would become larger, but considerably more
readable.  The sort of thing I had in mind was (adapting my compctl
for find which is age old and therefore not necessarily optimal):

compctl --prefix '-' --array "(atime ctime depth ...)" \
  --extended 'c[-1,-fstype]' --array "(nfs pc ufs cdfs)" \
  --or 'C[-1,-(name|cpio|newer)]' --file \
  --or 'c[-1,-type]' --array "(c b d f p l s)" \
  --or 'c[-1,-user]' --user \
  --or 'C[-1,-(exec|OK)]' --command \
  --or 'p[1]' --directory --end find

It's not clear to me if it's possible or desirable to overload names
like --or and --end for different circumstances to minimise the number
of extra options.  It should be possible to allow unambiguous
abbreviations.  Maybe even the extended completion choices can be
made clearer, e.g. 'compare-word[-1,-fstype]' and
'pattern-compare-word[-1,-(name|cpio|newer)]' or something more
compact.

It would also open up the possibility of having more control over
completion from within particular compctl's: it's easy to do in the
code, just hard to find the right options.  For example, there may be
particular cases where you want to use --menu-complete (e.g. in
combination with -U or --always-use).  That would be an improvement
over what I implemented for completion widgets.

Very likely it's not a good idea to implement anything like this until
after the current set of changes have appeared.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Gruppo Teorico, Dipartimento di Fisica
Piazza Torricelli 2, 56100 Pisa, Italy



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