mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-04 20:40:57 +02:00
33375: new sv completion
This commit is contained in:
parent
0cb4c23b39
commit
de56e09fcb
2 changed files with 75 additions and 0 deletions
|
@ -1,5 +1,7 @@
|
|||
2014-10-10 Oliver Kiddle <opk@zsh.org>
|
||||
|
||||
* fREW Schmidt: 33375: Completion/Unix/Command/_runit: sv completion
|
||||
|
||||
* Daniel Shahaf: 33396: Completion/Unix/Command/_xxd: new completion
|
||||
|
||||
* Yuri D'Elia: 33397: Completion/X/Command/_xautolock: new completion
|
||||
|
|
73
Completion/Unix/Command/_runit
Normal file
73
Completion/Unix/Command/_runit
Normal file
|
@ -0,0 +1,73 @@
|
|||
#compdef sv
|
||||
|
||||
_sv_commands() {
|
||||
local -a sv_ary
|
||||
sv_ary=(
|
||||
'status':'get status of service (and log service if available)'
|
||||
'up':'start if service is running. If service stops, restart'
|
||||
'down':'send SIGTERM and SIGCONT if service is running. After it stops, do not restart'
|
||||
'once':'start if service is not running. Do not restart if it stops'
|
||||
'pause':'send SIGSTOP if service is running'
|
||||
'cont':'send SIGCONT if service is running'
|
||||
'hup':'send SIGHUP if service is running'
|
||||
'alarm':'send SIGALRM if service is running'
|
||||
'interrupt':'send SIGINT if service is running'
|
||||
'quit':'send SIGQUIT if service is running'
|
||||
'1':'send SIGUSR1 if service is running'
|
||||
'2':'send SIGUSR2 if service is running'
|
||||
'term':'send SIGTERM if service is running'
|
||||
'kill':'send SIGKILL if service is running'
|
||||
'exit':'send SIGTERM and SIGCONT if service is running. Do not restart service.'
|
||||
)
|
||||
_describe -t commands "sv commands" sv_ary -V sv_commands
|
||||
}
|
||||
|
||||
_sv_lsb() {
|
||||
local -a sv_lsb_ary
|
||||
sv_lsb_ary=(
|
||||
'start':'up with check/timeout'
|
||||
'stop':'down with check/timeout'
|
||||
'reload':'hup with check'
|
||||
'restart':'down and up with check'
|
||||
'shutdown':'exit with check/timeout'
|
||||
'force-stop':'stop with kill on timeout'
|
||||
'force-reload':'reload with kill on timeout'
|
||||
'force-restart':'restart with kill on timeout'
|
||||
'force-shutdown':'shutdown with kill on timeout'
|
||||
'try-restart':'restart if service is already running'
|
||||
)
|
||||
|
||||
_describe -t lsb-commands "sv LSM init compat" sv_lsb_ary -V sv_init_compat
|
||||
}
|
||||
|
||||
_sv_additional() {
|
||||
_describe -t additional-commands "sv additional commands" '("check:check status of service")' -V sv_addl_comm
|
||||
}
|
||||
|
||||
local curcontext="$curcontext" state line
|
||||
_arguments -C \
|
||||
'-v[verbose]' \
|
||||
'-w[wait time]:time (seconds)' \
|
||||
'1: :->command' \
|
||||
'*:: :->options'
|
||||
|
||||
case $state in
|
||||
(command)
|
||||
_alternative \
|
||||
_sv_commands \
|
||||
_sv_lsb \
|
||||
_sv_additional
|
||||
;;
|
||||
|
||||
(options)
|
||||
local -a sv_services
|
||||
local svdir=${SVDIR:-/etc/service}
|
||||
sv_services=(
|
||||
$svdir/*(N)
|
||||
$svdir/*/log(N)
|
||||
)
|
||||
|
||||
sv_services=( ${sv_services#$svdir/} )
|
||||
_describe -t services "sv services" sv_services
|
||||
;;
|
||||
esac
|
Loading…
Reference in a new issue