summaryrefslogtreecommitdiffstats
path: root/Completion/Unix/Command
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2010-04-20 08:59:32 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2010-04-20 08:59:32 +0000
commitb230a690fa8a33551d229db083bca53a7075e1c8 (patch)
tree5a8f0a4e355067c972f2bcef824c35245fded547 /Completion/Unix/Command
parentunposted: update NEWS with path-completion style (diff)
downloadzsh-b230a690fa8a33551d229db083bca53a7075e1c8.tar
zsh-b230a690fa8a33551d229db083bca53a7075e1c8.tar.gz
zsh-b230a690fa8a33551d229db083bca53a7075e1c8.tar.bz2
zsh-b230a690fa8a33551d229db083bca53a7075e1c8.tar.lz
zsh-b230a690fa8a33551d229db083bca53a7075e1c8.tar.xz
zsh-b230a690fa8a33551d229db083bca53a7075e1c8.tar.zst
zsh-b230a690fa8a33551d229db083bca53a7075e1c8.zip
"Akinori MUSHA: 27892: update service & init completion for FreeBSD
Diffstat (limited to 'Completion/Unix/Command')
-rw-r--r--Completion/Unix/Command/.distfiles1
-rw-r--r--Completion/Unix/Command/_init_d99
-rw-r--r--Completion/Unix/Command/_service31
3 files changed, 107 insertions, 24 deletions
diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles
index a18293893..73525ff12 100644
--- a/Completion/Unix/Command/.distfiles
+++ b/Completion/Unix/Command/.distfiles
@@ -180,6 +180,7 @@ _samba
_sccs
_screen
_sed
+_service
_setfacl
_sh
_showmount
diff --git a/Completion/Unix/Command/_init_d b/Completion/Unix/Command/_init_d
index 72d11023f..dd9933a46 100644
--- a/Completion/Unix/Command/_init_d
+++ b/Completion/Unix/Command/_init_d
@@ -1,39 +1,90 @@
#compdef -p */(init|rc[0-9S]#).d/*
-local magic cmds what script
+local cmds script
_compskip=all
-# This should probably be system specific...
+if [[ $OSTYPE = freebsd* ]]; then
+ (( $+functions[_init_d_fullpath] )) ||
+ _init_d_fullpath() {
+ local -a scriptpath
+ local name=$1 dir
+ # Known locations of init scripts
+ # C.f. Unix/Type/_services
+ scriptpath=(/etc/rc.d $(/bin/sh -c '. /etc/rc.subr; load_rc_config XXX; echo $local_startup' 2>/dev/null))
-script=$words[1]
-if [[ $script != */* ]]; then
- local -a scriptpath
- local dir
- # Known locations of init scripts
- # C.f. Unix/Type/_services
- scriptpath=(/etc/init.d /etc/rc.d /etc/rc.d/init.d)
+ for dir in $scriptpath; do
+ if [[ -f $dir/$name ]]; then
+ echo $dir/$name
+ return 0
+ fi
+ done
+ return 1
+ }