summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2008-11-12 18:16:57 +0100
committerDaniel Friesel <derf@derf.homelinux.org>2008-11-12 18:16:57 +0100
commit668e1b4daddbb0e50df74feb965690a324c9512f (patch)
tree78df321afeffc4ffa93551b1597da042765afd57
parenta5afb958b99f94efaae240e65cfe9b189b4c9001 (diff)
initd completion: minor rework
- fix some corner cases in which force-$action exists while $action does not the completion is still rather... experimental, though
-rw-r--r--etc/completions/_initd6
1 files changed, 3 insertions, 3 deletions
diff --git a/etc/completions/_initd b/etc/completions/_initd
index d9f1f9c..e1c81b2 100644
--- a/etc/completions/_initd
+++ b/etc/completions/_initd
@@ -2,15 +2,15 @@
## vim:ft=zsh
typeset arguments file bang
-typeset action=${service:l}
-typeset what='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
+typeset specific=${service:l}
+typeset action='(st(art|op|atus)|(force-|)re(start|load)|debug_(up|down)|dump(|_stats)|add|delete|clean|list)'
typeset -a scripts
# Most of the loop's content has been taken from the _init_d
# completion function provided with zsh
for file in /etc/init.d/*(*); {
read -u0 -k2 bang < $file && [[ $bang == '#!' ]] &&
- [[ ${${(j:|:s:|:)${(M)${(f)"$(< $file)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} == *$action* ]] &&
+ [[ -n ${${(j:|:s:|:)${(M)${(f)"$(< $file)"}:#[[:blank:]]#(\'|)(${~action}[[:blank:]]#\|[[:blank:]]#)#${~specific}([[:blank:]]#\|[[:blank:]]#${~action})#(\'|)\)}}//[^-a-z_]} ]] &&
scripts+=${file##*/}
}