runit

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

sv.zsh (958B)


      1 #compdef sv
      2 
      3 # completion for runit sv(1)
      4 # Leah Neukirchen <leah@vuxu.org>
      5 # runit 2.1.1, services in /var/service are completed by default
      6 
      7 local ret=1 services
      8 
      9 _arguments \
     10     '-v[verbose]' \
     11     '-w[wait]:seconds' \
     12     '1: :->cmds' \
     13     '*:: :->args' && ret=0
     14 
     15 case $state in
     16 cmds)
     17     _values "sv command" \
     18         status \
     19         up \
     20         down \
     21         once \
     22         pause cont hup alarm interrupt quit 1 2 term kill \
     23         exit
     24     # above allow one-character shortcuts, complete these
     25     [[ $words[CURRENT] = [sudopchaiq12tke] ]] ||
     26     _values "sv command" \
     27         start \
     28         stop \
     29         restart \
     30         shutdown \
     31         force-stop \
     32         force-reload \
     33         force-restart \
     34         force-shutdown \
     35         check
     36     ret=0;;
     37 args)
     38     services=( /var/service/*(-/N:t) )
     39     (( $#services )) && _values services $services && ret=0
     40     [[ $words[CURRENT] = */* ]] && _directories && ret=0
     41     ;;
     42 esac
     43 
     44 return $ret