summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-01-14 14:17:50 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-01-14 14:17:50 +0000
commit8476aa7fc2faea453c3e07dae2e58535fa2a7086 (patch)
tree00db47131ac6c3394bd8442b8e2c66b85a740c70
parent64ba6ab2456265e7b03fa9aa2751b55dafdc41ee (diff)
downloadzsh-8476aa7fc2faea453c3e07dae2e58535fa2a7086.tar.gz
zsh-8476aa7fc2faea453c3e07dae2e58535fa2a7086.tar.xz
zsh-8476aa7fc2faea453c3e07dae2e58535fa2a7086.zip
16449: new chkconfig completion for both the RedHat and IRIX commands
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Command/_chkconfig33
2 files changed, 38 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index f3a368fe6..e97b8ca52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2002-01-14  Oliver Kiddle  <opk@zsh.org>
+
+	* 16449: Completion/Unix/Command/_chkconfig: new completion for
+	both the IRIX and RedHat chkconfig commands
+
 2002-01-14  Peter Stephenson  <pws@csr.com>
 
 	* 16448: Src/math.c: 15291, 15292 introduced bug that assignment
diff --git a/Completion/Unix/Command/_chkconfig b/Completion/Unix/Command/_chkconfig
new file mode 100644
index 000000000..92bc60c60
--- /dev/null
+++ b/Completion/Unix/Command/_chkconfig
@@ -0,0 +1,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