Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: new _update-rc.d



new completion function for update-rc.d (Debian's equivalent of chkconfig).

_services was picking up things like README files so I've restricted it to
executables.

Index: Completion/Debian/Command/_update-rc.d
===================================================================
RCS file: Completion/Debian/Command/_update-rc.d
diff -N Completion/Debian/Command/_update-rc.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ Completion/Debian/Command/_update-rc.d	15 Jan 2004 16:46:54 -0000
@@ -0,0 +1,28 @@
+#compdef update-rc.d
+
+local curcontext="$curcontext" state line expl
+
+_arguments -C \
+  '-n[show actions without performing them]' \
+  '-f[force removal of symlinks]' \
+  '1:service:_services' \
+  '2:command:(remove defaults start stop)' \
+  '*::args:->args' && return
+
+case $words[2] in
+  defaults)
+    _message -e number 'sequence number'
+  ;;
+  remove)
+    _message 'no more arguments'
+  ;;
+  st*)
+    case ${words[CURRENT-1]} in
+      .) _wanted commands expl commands compadd start stop && return ;;
+      start|stop) _message -e number 'sequence number' ;;
+      *) _message -e runlevels run\ level ;;
+    esac
+  ;;
+esac
+
+return 1
Index: Completion/Unix/Type/_services
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_services,v
retrieving revision 1.2
diff -u -r1.2 _services
--- Completion/Unix/Type/_services	14 May 2002 08:08:45 -0000	1.2
+++ Completion/Unix/Type/_services	15 Jan 2004 16:46:54 -0000
@@ -8,7 +8,7 @@
   inits=( ${${${alls[1,(r)xinetd based*]}[1,-2]}/%[[:space:]]*/} )
   xinetds=( ${${${${alls[(r)xinetd based*,-1]}[2,-1]}/#[[:space:]]#}/%:*} )
 else
-  inits=( /etc/init.d/*(:t) )
+  inits=( /etc/init.d/*(-*:t) )
 fi
 
 _tags init xinetd



Messages sorted by: Reverse Date, Date, Thread, Author