runit

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

sv.bash (691B)


      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