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

need help with compctl for NT



hi,

I want to complete  (For zsh 3.0.x only) the command "net stop" with the
output
of the command "net start". The output looks something like this:

These Windows 2000 services are started:

   Computer Browser
   Logical Disk Manager
   Messenger
   Net Logon
   Workstation

The command completed successfully.


I came up with a completion that seems to work:

     'c[-1,stop]' -s "$(net.exe start|grep.exe -v ^T|sed.exe -ne
's/\([A-Z][a-zA
-Z].*\)/"\1"/p')" \


The only problem is that this completion only collects the output of "net
start"
on shell startup.  I would like the list to be updated every time i run "net
stop ..."

I tried using -K with a function like so:

function fooger {
    IFS=\t\n
    reply=(`net.exe start|grep.exe -v ^T|sed.exe -ne
's/\([A-Z][a-zA-Z].*\)/"\1"
/p'`); }

the problem with this approach is that it ignores the quotes and seperates
the
words anyway.

Thus, "Computer Browser" becomes
"Computer
Browser"
i.e, 2 separate array elements.


Firstly, is my assumption that the function will run every time i type 
"net stop <tab>" correct ?

If yes, then is there any way to get what I want to actually work ?

thanks,.
-amol

PS:
If all this is really confusing here's the bottom line:

How do i get a completion to be the dynamically updated output
from an external command, where the command output may
contain components with whitepace (just space usually)  ?



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