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

zsh completion problem


I have developed svc-restart, svc-stop, etc. helper functions to call  
/etc/init.d scripts. Here is the configuration:

---conf start
function _c-getdaemons() {
            if [[ -r /etc/init.d ]] ; then
               local f
               for f in /etc/init.d/*(:t); _wanted module expl  
'daemons' compadd $f ;
if [[ -d /etc/init.d ]] ; then
     for i in svc-start svc-restart svc-stop svc-force-reload svc-reload ; do
         eval "function $i() {
                 $SUDO /etc/init.d/\$1 ${i/#svc-/}
         compdef _c-getdaemons $i

Now my problem: If I call zsh the first time I do not get the right  
completion. I type "svc-restart <TAB>" and I get the "files"  
completion. If I "reload" zsh - and try it again I get the "daemons"  
completion I have defined. Here is the reload function I use:

---conf start
function reload() {
         if [[ "$#*" -eq 0 ]]; then
                 test -r /etc/zsh/zsh-oli && . /etc/zsh/zsh-oli
                 test -r ~/.zshrc && . ~/.zshrc
                 return 0
                 local fn
                 for fn in $*; do
                    unfunction $fn
                    autoload -U $fn
compdef _functions reload

Oliver Paulus

Key id: 28D9C44F
Fingerprint: EADA 62FC 07DC 3361 A3D6  4174 2DE3 C027 28D9 C44F
Public Key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x28D9C44F
In 5 Schritten zur eigenen Homepage. Jetzt Domain sichern und gestalten! 
Nur 3,99 EUR/Monat! http://www.maildomain.web.de/?mc=021114

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