summary refs log tree commit diff
path: root/Completion/SysV/_sysv_initscripts
blob: 2f0a520f9ba4ee013a453127380f62c9455b5b4d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#compdef -p /etc/(init|rc[0-9S]).d/*

local stdargs nonstdargs expl

if [[ -f $words[1] ]]
then
nonstdargs=(${${(s: :)${${${${(M)${(f)"$(<$words[1])"}:#[	 a-z-|]##\)*}%\)*}##\ #}:gs/|/ /}:s/	//}:#(start|stop|restart|force-reload|reload)})
stdargs=(${(M)${(s: :)${${${${(M)${(f)"$(<$words[1])"}:#[	 a-z-|]##\)*}%\)*}##\ #}:gs/|/ /}:s/	//}:#(start|stop|restart|force-reload|reload)})
else
nonstdargs=()
stdargs=(start stop restart force-reload)
fi

_tags nonstdargs stdargs

_wanted -V stdargs expl "standard arguments" compadd -a stdargs
_wanted nonstdargs expl "non-standard arguments" compadd -a nonstdargs