completion supports multiple commands
This commit is contained in:
parent
f08b857aff
commit
03e3953eb8
1 changed files with 2 additions and 15 deletions
|
@ -1,7 +1,6 @@
|
||||||
_pulseaudio_tcp_completions() {
|
_pulseaudio_tcp_completions() {
|
||||||
local \
|
local \
|
||||||
command_list \
|
command_list \
|
||||||
command_pattern \
|
|
||||||
commands \
|
commands \
|
||||||
cur \
|
cur \
|
||||||
option_list \
|
option_list \
|
||||||
|
@ -21,20 +20,8 @@ _pulseaudio_tcp_completions() {
|
||||||
commands=("${commands[@]/$word}")
|
commands=("${commands[@]/$word}")
|
||||||
done
|
done
|
||||||
|
|
||||||
if "$more_options" ; then
|
"$more_options" && option_list="${options[*]}"
|
||||||
option_list="${options[*]}"
|
command_list="${commands[*]}"
|
||||||
else
|
|
||||||
option_list=""
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf -v command_pattern "%s|" "${commands[@]}"
|
|
||||||
command_pattern="(${command_pattern%?})"
|
|
||||||
|
|
||||||
if [[ ${COMP_WORDS[*]} =~ $command_pattern ]] ; then
|
|
||||||
command_list=""
|
|
||||||
else
|
|
||||||
command_list="${commands[*]}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
mapfile -t COMPREPLY < <( compgen -W "$option_list $command_list" -- "$cur")
|
mapfile -t COMPREPLY < <( compgen -W "$option_list $command_list" -- "$cur")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue