File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # bash completion for runit sv(1)
2+
3+ _sv ()
4+ {
5+ local cur prev words cword commands
6+ _init_completion || return
7+
8+ commands=' up down status once pause cont hup alarm interrupt 1 2 term kill exit start stop restart shutdown force-stop force-reload force-restart force-shutdown'
9+
10+ case $prev in
11+ -w)
12+ return
13+ ;;
14+ -* | sv)
15+ COMPREPLY=( $( compgen -W " ${commands} " -- ${cur} ) )
16+ return
17+ ;;
18+ * )
19+ COMPREPLY=( /var/service/* )
20+ COMPREPLY=( ${COMPREPLY[@]##*/ } )
21+ COMPREPLY=( $( compgen -W ' ${COMPREPLY[@]}' -- ${cur} ) )
22+ return
23+ ;;
24+ esac
25+ }
26+ complete -F _sv sv
Original file line number Diff line number Diff line change 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
You can’t perform that action at this time.
0 commit comments