/etc/bash_completion.d/pulseaudio-bash-completion.sh is in pulseaudio-utils 1:4.0-0ubuntu11.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 | #!/bin/bash
__cards () {
while IFS=$'\t' read idx name _; do
printf "%s %s\n" "$idx" "$name"
done < <(pactl list cards short 2> /dev/null)
}
__sinks () {
while IFS=$'\t' read _ name _ _ _; do
printf "%s\n" "$name"
done < <(pactl list sinks short 2> /dev/null)
}
__sinks_idx () {
while IFS=$'\t' read idx _ _ _ _; do
printf "%s\n" "$idx"
done < <(pactl list sinks short 2> /dev/null)
}
__sources () {
while IFS=$'\t' read _ name _ _ _; do
printf "%s\n" "$name"
done < <(pactl list sources short 2> /dev/null)
}
__sink_inputs () {
while IFS=$'\t' read idx _ _ _ _; do
printf "%s\n" "$idx"
done < <(pactl list sink-inputs short 2> /dev/null)
}
__source_outputs () {
while IFS=$'\t' read idx _ _ _ _; do
printf "%s\n" "$idx"
done < <(pactl list source-outputs short 2> /dev/null)
}
__ports () {
pactl list cards 2> /dev/null | awk -e \
'/^\tPorts:/ {
flag=1; next
}
/^\t[A-Za-z]/ {
flag=0
}
flag {
if (/^\t\t[A-Za-z]/)
ports = ports substr($0, 3, index($0, ":")-3) " "
}
END {
print ports
}'
}
__profiles () {
pactl list cards 2> /dev/null | awk -e \
'/^\tProfiles:/ {
flag=1; next
}
/^\t[A-Za-z]/ {
flag=0
}
flag {
if (/^\t\t[A-Za-z]/)
profiles = profiles substr($0, 3, index($0, ": ")-3) " "
}
END {
print profiles
}'
}
__all_modules () {
while read name; do
name=${name%% *}
printf "%s\n" "$name"
done < <(pulseaudio --dump-modules 2> /dev/null)
}
__loaded_modules () {
while IFS=$'\t' read idx name _; do
printf "%s %s\n" "$idx" "$name"
done < <(pactl list modules short 2> /dev/null)
}
__resample_methods () {
while read name; do
printf "%s\n" "$name"
done < <(pulseaudio --dump-resample-methods 2> /dev/null)
}
_pacat_file_formats () {
while IFS=$'\t' read name _; do
printf "%s\n" "$name"
done < <(pacat --list-file-formats 2> /dev/null)
}
in_array() {
local i
for i in "${@:2}"; do
[[ $1 = "$i" ]] && return
done
}
_pactl() {
local cur prev words cword preprev command
local comps
local flags='-h --help --version -s --server= --client-name='
local list_types='short sinks sources sink-inputs source outputs cards
modules samples clients'
local commands=(stat info list exit upload-sample play-sample remove-sample
load-module unload-module move-sink-input move-source-output
suspend-sink suspend-source set-card-profile set-sink-port
set-source-port set-sink-volume set-source-volume
set-sink-input-volume set-source-output-volume set-sink-mute
set-source-mute set-sink-input-mute set-source-output-mute
set-sink-formats set-port-latency-offset subscribe help)
_init_completion -n = || return
preprev=${words[$cword-2]}
for word in "${COMP_WORDS[@]}"; do
if in_array "$word" "${commands[@]}"; then
command=$word
break
fi
done
case $preprev in
list) COMPREPLY=($(compgen -W 'short' -- "$cur")) ;;
play-sample)
comps=$(__sinks)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
move-sink-input)
comps=$(__sinks)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
move-source-output)
comps=$(__sources)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-card-profile)
comps=$(__profiles)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-*-port)
comps=$(__ports)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-*-mute) COMPREPLY=($(compgen -W 'true false toggle' -- "$cur")) ;;
set-sink-formats)
;; #TODO
set-port-*)
comps=$(__ports)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
--server)
compopt +o nospace
_known_hosts_real "$cur"
;;
esac
[[ $COMPREPLY ]] && return 0
case $prev in
list) COMPREPLY=($(compgen -W '${list_types[*]}' -- "$cur")) ;;
stat) COMPREPLY=($(compgen -W 'short' -- "$cur")) ;;
upload-sample) _filedir ;;
play-sample) ;; # TODO
remove-sample) ;; # TODO
load-module)
comps=$(__all_modules)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
unload-module)
comps=$(__loaded_modules)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-card*)
comps=$(__cards)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*sink-input*)
comps=$(__sink_inputs)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*source-output*)
comps=$(__source_outputs)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-sink-formats)
comps=$(__sinks_idx)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*sink*)
comps=$(__sinks)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*source*)
comps=$(__sources)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-port*)
comps=$(__cards)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
-s)
_known_hosts_real "$cur" ;;
esac
[[ $COMPREPLY ]] && return 0
case $cur in
--server=*)
cur=${cur#*=}
_known_hosts_real "$cur"
;;
-*)
COMPREPLY=($(compgen -W '${flags[*]}' -- "$cur"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
;;
*)
[[ -z $command ]] && COMPREPLY=($(compgen -W '${commands[*]}' -- "$cur"))
;;
esac
}
complete -F _pactl pactl
_pacmd() {
local cur prev words cword preprev command
local comps
local flags='-h --help --version'
local commands=(exit help list-modules list-sinks list-sources list-clients
list-samples list-sink-inputs list-source-outputs stat info
load-module unload-module describe-module set-sink-volume
set-source-volume set-sink-input-volume set-source-output-volume
set-sink-mute set-source-mut set-sink-input-mute
set-source-output-mute update-sink-proplist update-source-proplist
update-sink-input-proplist update-source-output-proplist
set-default-sink set-default-source kill-client kill-sink-input
kill-source-output play-sample remove-sample load-sample
load-sample-lazy load-sample-dir-lazy play-file dump
move-sink-input move-source-output suspend-sink suspend-source
suspend set-card-profile set-sink-port set-source-port
set-port-latency-offset set-log-target set-log-level set-log-meta
set-log-time set-log-backtrace)
_init_completion -n = || return
preprev=${words[$cword-2]}
for word in "${COMP_WORDS[@]}"; do
if in_array "$word" "${commands[@]}"; then
command=$word
break
fi
done
case $preprev in
play-sample|play-file)
comps=$(__sinks)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
load-sample*) _filedir ;;
move-sink-input)
comps=$(__sinks)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
move-source-output)
comps=$(__sources)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-card-profile)
comps=$(__profiles)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-*port*)
comps=$(__ports)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-*-mute) COMPREPLY=($(compgen -W 'true false' -- "$cur"));;
set-sink-formats)
;; #TODO
esac
case $prev in
list-*) ;;
describe-module|load-module)
comps=$(__all_modules)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
unload-module)
comps=$(__loaded_modules)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
load-sample-dir-lazy) _filedir -d ;;
play-file) _filedir ;;
*sink-input*)
comps=$(__sink_inputs)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*source-output*)
comps=$(__source_outputs)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*sink*)
comps=$(__sinks)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
*source*)
comps=$(__sources)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-card*)
comps=$(__cards)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-port-*)
comps=$(__cards)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
set-log-target)
COMPREPLY=($(compgen -W 'auto syslog stderr file: newfile:' -- "$cur"))
;;
set-log-level)
COMPREPLY=($(compgen -W '{0..4}' -- "$cur"))
;;
set-log-meta|set-log-time|suspend)
COMPREPLY=($(compgen -W 'true false' -- "$cur"))
;;
esac
case $cur in
-*) COMPREPLY=($(compgen -W '${flags[*]}' -- "$cur")) ;;
suspend)
COMPREPLY=($(compgen -W 'suspend suspend-sink suspend-source' -- "$cur"))
;;
load-sample)
COMPREPLY=($(compgen -W 'load-sample load-sample-lazy load-sample-dir-lazy' -- "$cur"))
;;
*)
[[ -z $command ]] && COMPREPLY=($(compgen -W '${commands[*]}' -- "$cur"))
;;
esac
}
complete -F _pacmd pacmd
_pasuspender () {
local cur prev
local flags='-h --help --version -s --server='
_init_completion -n = || return
case $cur in
--server=*)
cur=${cur#*=}
_known_hosts_real "$cur"
;;
-*)
COMPREPLY=($(compgen -W '${flags[*]}' -- "$cur"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
;;
esac
case $prev in
-s) _known_hosts_real "$cur" ;;
esac
}
complete -F _pasuspender pasuspender
_padsp () {
local cur prev
local flags='-h -s -n -m -M -S -D -d'
_get_comp_words_by_ref cur prev
case $cur in
-*) COMPREPLY=($(compgen -W '${flags[*]}' -- "$cur")) ;;
esac
case $prev in
-s) _known_hosts_real "$cur" ;;
esac
}
complete -F _padsp padsp
_pacat () {
local cur prev comps
local flags='-h --help --version -r --record -p --playback -v --verbose -s
--server= -d --device= -n --client-name= --stream-name= --volume=
--rate= --format= --channels= --channel-map= --fix-format --fix-rate
--fix-channels --no-remix --no-remap --latency= --process-time=
--latency-msec= --process-time-msec= --property= --raw --passthrough
--file-format= --list-file-formats'
_init_completion -n = || return
case $cur in
--server=*)
cur=${cur#*=}
_known_hosts_real "$cur"
;;
--device=*)
cur=${cur#*=}
comps=$(__sinks)
comps+=$(__sources)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
--rate=*)
cur=${cur#*=}
COMPREPLY=($(compgen -W '32000 44100 48000 9600 192000' -- "$cur"))
;;
--file-format=*)
cur=${cur#*=}
comps=$(_pacat_file_formats)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
--*=*)
;;
-*)
COMPREPLY=($(compgen -W '${flags[*]}' -- "$cur"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
;;
*) _filedir ;;
esac
case $prev in
-s) _known_hosts_real "$cur" ;;
-d)
comps=$(__sinks)
comps+=$(__sources)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
esac
}
complete -F _pacat pacat paplay parecord
_pulseaudio()
{
local cur prev words cword
local flags='-h --help --version --dump-conf --dump-resample-methods --cleanup-shm
--start -k --kill --check --system= -D --daemonize= --fail= --high-priority=
--realtime= --disallow-module-loading= --disallow-exit= --exit-idle-time=
--scache-idle-time= --log-level= -v --log-target= --log-meta= --log-time=
--log-backtrace= -p --dl-search-path= --resample-method= --use-pit-file=
--no-cpu-limit= --disable-shm= -L --load= -F --file= -C -n'
_init_completion -n = || return
case $cur in
--system=*|--daemonize=*|--fail=*|--high-priority=*|--realtime=*| \
--disallow-*=*|--log-meta=*|--log-time=*|--use-pid-file=*| \
--no-cpu-limit=*|--disable-shm=*)
cur=${cur#*=}
COMPREPLY=($(compgen -W 'true false' -- "$cur"))
;;
--log-target=*)
cur=${cur#*=}
COMPREPLY=($(compgen -W 'auto syslog stderr file: newfile:' -- "$cur"))
;;
--log-level=*)
cur=${cur#*=}
COMPREPLY=($(compgen -W '{0..4}' -- "$cur"))
;;
--dl-search-path=*)
cur=${cur#*=}
_filedir -d
;;
--file=*)
cur=${cur#*=}
_filedir
;;
--resample-method=*)
cur=${cur#*=}
comps=$(__resample_methods)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
--load=*)
cur=${cur#*=}
comps=$(__all_modules)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
--*=*)
;;
-*)
COMPREPLY=($(compgen -W '${flags[*]}' -- "$cur"))
[[ $COMPREPLY == *= ]] && compopt -o nospace
;;
esac
case $prev in
-D) COMPREPLY=($(compgen -W 'true false' -- "$cur")) ;;
-p) _filedir -d ;;
-F) _filedir ;;
-L)
cur=${cur#*=}
comps=$(__all_modules)
COMPREPLY=($(compgen -W '${comps[*]}' -- "$cur"))
;;
esac
}
complete -F _pulseaudio pulseaudio
#vim: set ft=zsh sw=4 ts=4 noet
|