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

completion help?



I've never really understood completions functions.

I have two commands "run" and "open -a" which I would like to be able to  
supply Application's names to.

I can get the names of the applications using this:

sed 's/.*\///g' ~/.AppInfo/LaunchBar/Setup|sed 's/\.app$//g'

(~/.AppInfo/LaunchBar/Setup is an ASCII file, one app per line)

How can I make a function that will allow me to do:

run [tab]

to cycle through the apps and

run S[tab]

to cycle through the apps which start with an 'S'?


I tried this (adapted from something someone gave me for something else)


allapps ()
   {
   apppath=(`sed 's/.*\///g' ~/.AppInfo/LaunchBar/Setup \
   | sed 's/\.app$//g'`)
   reply=$apppath;
   }


compctl -K allapps 'S[-]' -- run

but when I hit tab nothing happens....

Clues for the clueless?

TjL



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