add bash completion support
This commit is contained in:
22
pulseaudio-tcp.bash_completion
Normal file
22
pulseaudio-tcp.bash_completion
Normal file
@ -0,0 +1,22 @@
|
||||
_pulseaudio_tcp_completions() {
|
||||
local cur options commands delete
|
||||
|
||||
cur=${COMP_WORDS[COMP_CWORD]}
|
||||
options=( "--debug" "--help" "--nogui" )
|
||||
commands=( "start" "stop" "status" "setup" "restart" )
|
||||
|
||||
for delete in "${COMP_WORDS[@]::${#COMP_WORDS[@]}-1}" ; do
|
||||
options=("${options[@]/$delete}")
|
||||
commands=("${commands[@]/$delete}")
|
||||
done
|
||||
|
||||
COMPREPLY=()
|
||||
|
||||
case "$cur" in
|
||||
'') mapfile -t COMPREPLY < <(compgen -W "${options[*]} ${commands[*]}" -- "$cur") ;;
|
||||
-*) mapfile -t COMPREPLY < <(compgen -W "${options[*]}" -- "$cur") ;;
|
||||
[^-]*) mapfile -t COMPREPLY < <(compgen -W "${commands[*]}" -- "$cur") ;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
} && complete -F _pulseaudio_tcp_completions pulseaudio-tcp
|
Reference in New Issue
Block a user