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() {
|
||||
local \
|
||||
command_list \
|
||||
command_pattern \
|
||||
commands \
|
||||
cur \
|
||||
option_list \
|
||||
|
@ -21,20 +20,8 @@ _pulseaudio_tcp_completions() {
|
|||
commands=("${commands[@]/$word}")
|
||||
done
|
||||
|
||||
if "$more_options" ; then
|
||||
option_list="${options[*]}"
|
||||
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
|
||||
"$more_options" && option_list="${options[*]}"
|
||||
command_list="${commands[*]}"
|
||||
|
||||
mapfile -t COMPREPLY < <( compgen -W "$option_list $command_list" -- "$cur")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue