diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-12 16:41:43 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-11-12 16:41:43 +0100 |
commit | a5afb958b99f94efaae240e65cfe9b189b4c9001 (patch) | |
tree | 9400a53b39608156052d1145e7680c7bf8ec9a0b | |
parent | bab975d8c9753d2bd1aac62aeab15dc1376babdd (diff) |
initd completion: Also detect scripts with syntax like "restart|reload)"...
-rw-r--r-- | etc/completions/_initd | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/etc/completions/_initd b/etc/completions/_initd index 52dd91b..d9f1f9c 100644 --- a/etc/completions/_initd +++ b/etc/completions/_initd @@ -3,13 +3,14 @@ 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 -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 == '#!' ]] && - [[ -n ${${(j:|:s:|:)${(M)${(f)"$(< $file)"}:#[[:blank:]]#(\'|)${~action}([[:blank:]]#\|[[:blank:]]#${~action})#(\'|)\)}}//[^-a-z_]} ]] && + [[ ${${(j:|:s:|:)${(M)${(f)"$(< $file)"}:#[[:blank:]]#(\'|)${~what}([[:blank:]]#\|[[:blank:]]#${~what})#(\'|)\)}}//[^-a-z_]} == *$action* ]] && scripts+=${file##*/} } |