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

Re: init.d completion



On Mar 11,  5:38pm, Bart Schaefer wrote:
} Subject: Re: init.d completion
}
} On Mar 11,  2:34pm, Andrej Borsenkow wrote:
} } Subject: init.d completion
} }
} } Most (many) of scripts in our /etc/init.d are not executable, so I have to
} } use 'sh foo' instead of plain 'foo'. Not sure how to handle it; putting
} } special case in sh completion?
} 
} _sh is pretty braindead at the moment.  Unless you're using "sh -c ..."
} it only uses _default completion.  Here's a fairly simple potential fix:

Sorry, that doesn't quite cut it.  Better:


Index: Completion/User/_sh
===================================================================
diff -c -r1.1.1.1 _sh
--- Completion/User/_sh	1999/07/20 08:11:00	1.1.1.1
+++ Completion/User/_sh	2001/03/11 18:16:38
@@ -4,5 +4,10 @@
   compset -q
   _normal
 else
+  local n=${words[(b:2:i)[^-]*]}
+  if (( n <= CURRENT )); then
+    compset -n $n
+    _normal && return 0
+  fi
   _default
 fi

-- 
Bart Schaefer                                 Brass Lantern Enterprises
http://www.well.com/user/barts              http://www.brasslantern.com

Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net   



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