about summary refs log tree commit diff
path: root/Completion/Unix/Command/_chkconfig
blob: 92bc60c60f107662737a9f574870e5d31ae4145d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#compdef chkconfig

local curcontext="$curcontext" state line ret=1

case $OSTYPE in
linux*)
  _arguments -C \
    '(- 2)--list[list services]' \
    '(-)--level[specify runlevels to apply to]:-:_values -s "" "run levels" 1 2 3 4 5 6 7' \
    '(- 2)--add[add new service]' \
    '(- 2)--del[remove service from chkconfig management]' \
    '1:service name:->services' \
    '2:state:(on off reset)' && ret=0

  if [[ -n "$state" ]]; then
    _wanted services expl 'system service' \
	compadd ${${${(f)"$($words[1] --list)"}%%[ :]*}##$'\t'*} && ret=0
  fi
;;
irix*)
  _arguments -C \
    '(- 1)-s[print state of configuration flags]' \
    '(1 -s)-f[set flag state]:configuration flag:->flag:state:(on off)' \
    '1:configuration flag:->flag' && ret=0

  if [[ -n "$state" ]]; then
    _wanted conf-flags expl 'configuration flag' \
	compadd ${${${(f)"$($words[1])"}[4,-1]##$'\t'}%% *} && ret=0
  fi
;;
esac

return ret