-
-
Save robbieh/bccfcae3ed6496fca5b4a28738c24933 to your computer and use it in GitHub Desktop.
/etc/bash_completion.d/sv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_runit_sv() { | |
local cur prev commands opts services | |
COMPREPLY=() | |
cur="${COMP_WORDS[COMP_CWORD]}" | |
prev="${COMP_WORDS[COMP_CWORD-1]}" | |
commands="status up down once \ | |
pause cont hup alarm interrupt quit 1 2 term kill exit \ | |
start stop reload restart shutdown \ | |
force-stop force-reload force-restart force-shutdown try-restart check" | |
opts="-w -v" | |
if [ -z "$SVDIR" ]; then | |
services="$(ls --color=no -A /etc/service)" | |
else | |
services="$(ls --color=no -A "$SVDIR")" | |
fi | |
if [[ ${prev} == "sv" ]]; then | |
COMPREPLY=( $(compgen -W "${commands}" -- ${cur}) ) | |
elif [[ ${cur} == -* ]] ; then | |
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) | |
else | |
COMPREPLY=( $(compgen -W "${services}" -- ${cur}) ) | |
fi | |
return 0 | |
} | |
complete -F _runit_sv sv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Stop ls from printing color codes.