[4145] | 1 | # |
---|
| 2 | # /etc/bash_completion.d/roaraudio |
---|
| 3 | # |
---|
| 4 | # Bash completion function for the RoarAudio. |
---|
| 5 | # http://roaraudio.keep-cool.org/ |
---|
| 6 | # |
---|
| 7 | # Philipp "ph3-der-loewe" Schafft <lion@lion.leolix.org> |
---|
| 8 | # -- |
---|
| 9 | # |
---|
| 10 | |
---|
| 11 | # Tools supported completly: |
---|
| 12 | #roard |
---|
| 13 | |
---|
| 14 | # Tools supported partly: |
---|
| 15 | |
---|
| 16 | # Tools not supported at all: |
---|
| 17 | |
---|
| 18 | # Tools not supported at all and unimportent: |
---|
| 19 | |
---|
| 20 | # Unsupported devel tools: |
---|
| 21 | |
---|
| 22 | # The rest: |
---|
[5136] | 23 | #roarcat |
---|
| 24 | #roarcatplay |
---|
| 25 | #roarcatvio |
---|
| 26 | #roarbidir |
---|
| 27 | #roarmon |
---|
[4145] | 28 | #roarmonhttp |
---|
[5136] | 29 | #roarradio |
---|
| 30 | #roarctl |
---|
| 31 | #roarlight |
---|
| 32 | #roarinterconnect |
---|
| 33 | #roarclientpass |
---|
| 34 | #roarfilt |
---|
| 35 | #roarvumeter |
---|
| 36 | #roarsockconnect |
---|
| 37 | #roarphone |
---|
| 38 | #roarshout |
---|
| 39 | #roartypes |
---|
| 40 | #roar-config |
---|
| 41 | #roarvorbis |
---|
| 42 | #roarsin |
---|
| 43 | #roardtmf |
---|
| 44 | #roarvio |
---|
[4145] | 45 | |
---|
| 46 | _roar_no_opts() { |
---|
| 47 | COMPREPLY=() |
---|
| 48 | } |
---|
| 49 | complete -F _roar_no_opts roarsocktypes roartypes |
---|
| 50 | |
---|
| 51 | _roar_server() { |
---|
| 52 | COMPREPLY=( $(_roar_server_exec "$1") ) |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | _roar_server_exec() { |
---|
[5136] | 56 | local cur link words nodes stdsocks x11sock file_based file_based_ok |
---|
| 57 | local addr |
---|
[4145] | 58 | cur="$1" |
---|
| 59 | link=$(readlink /etc/roarserver 2> /dev/null) |
---|
| 60 | |
---|
| 61 | nodes=$(grep '^\(node\|executor\)' /etc/decnet.conf 2> /dev/null | sed 's/^.*\tname\t\t*//; s/\t.*$//; s/$/::/') |
---|
| 62 | |
---|
[5136] | 63 | file_based="/tmp/roar $HOME/.roar /tmp/muroard" |
---|
| 64 | stdsocks="localhost ::roar"; |
---|
[4145] | 65 | |
---|
| 66 | x11sock=$(xprop -root 2>/dev/null | grep '^ROAR_SERVER(STRING) = ' | sed 's/^[^"]*"//; s/"$//') |
---|
| 67 | |
---|
[5136] | 68 | file_based_ok="" |
---|
| 69 | for addr in $file_based |
---|
| 70 | do |
---|
| 71 | if [ -S "$addr" ] |
---|
| 72 | then |
---|
| 73 | file_based_ok="$file_based_ok $addr" |
---|
| 74 | fi |
---|
| 75 | done |
---|
| 76 | |
---|
| 77 | words="$ROAR_SERVER $link $nodes $file_based_ok $stdsocks $x11sock +slp +fork +abstract" |
---|
[4145] | 78 | |
---|
| 79 | compgen -A hostname $cur |
---|
| 80 | compgen -W "$words" $cur |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | _roar_jumbo_mtu() { |
---|
| 84 | COMPREPLY=($(compgen -W "750 1000 1100 1200 1300" -- "${COMP_WORDS[COMP_CWORD]}")) |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | _roar_rate() { |
---|
| 88 | local cur |
---|
| 89 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 90 | COMPREPLY=($(compgen -W "8000 16000 32000 11025 22050 44100 48000 96000" -- ${cur})) |
---|
| 91 | } |
---|
| 92 | |
---|
| 93 | _roar_bits() { |
---|
| 94 | local cur |
---|
| 95 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 96 | COMPREPLY=($(compgen -W "8 16 24 32" -- ${cur})) |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | _roar_channels() { |
---|
| 100 | local cur |
---|
| 101 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 102 | COMPREPLY=($(compgen -W "1 2 3 4 5 6 7 8 9" -- ${cur})) |
---|
| 103 | } |
---|
| 104 | |
---|
| 105 | _roar_codec() { |
---|
| 106 | local cur |
---|
| 107 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 108 | words=$(roard --list-cf | tail -n +4 | sed 's/^ *//; s/ .*$//') |
---|
| 109 | COMPREPLY=($(compgen -W "${words} default pcm" -- ${cur})) |
---|
| 110 | } |
---|
| 111 | |
---|
| 112 | _roar_flag() { |
---|
| 113 | local cur |
---|
| 114 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
[5124] | 115 | COMPREPLY=($(compgen -W "meta primary sync cleanmeta hwmixer pause mute mmap antiecho recsource passmixer virtual prethru immutable enhance singlesink" -- ${cur})) |
---|
[4145] | 116 | } |
---|
| 117 | |
---|
| 118 | _roar_dir() { |
---|
| 119 | local cur |
---|
| 120 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 121 | COMPREPLY=($(compgen -W "play record monitor filter output mixing meta bidir thru bridge midi_in midi_out light_in light_out raw_in raw_out complex_in complex_out rdtcs_in rdtcs_out" -- ${cur})) |
---|
| 122 | } |
---|
| 123 | |
---|
| 124 | _roar_metatype() { |
---|
| 125 | local cur |
---|
| 126 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
[5124] | 127 | #phi@ph7:roaraudio $ echo $(grep '^#define ROAR_META_TYPE_' include/roaraudio/meta.h | cut -d_ -f4,5,6,7,8,9 | cut -d' ' -f1 | tr A-Z a-z) |
---|
| 128 | COMPREPLY=($(compgen -W "none title album author autor artist version date license tracknumber organization description genre location contact streamurl homepage thumbnail length comment other filename fileurl server duration www woaf encoder encodedby year discid rpg_track_peak rpg_track_gain rpg_album_peak rpg_album_gain hash signalinfo audioinfo offset performer copyright likeness composer rights isrc language gtin isbn ean publisher discnumber sourcemedia label labelno" -- ${cur})) |
---|
[4145] | 129 | } |
---|
| 130 | |
---|
| 131 | _roar_baseopts() { |
---|
| 132 | case "$1" in |
---|
| 133 | '--rate') |
---|
| 134 | _roar_rate |
---|
| 135 | return 0 |
---|
| 136 | ;; |
---|
| 137 | '--bits') |
---|
| 138 | _roar_bits |
---|
| 139 | return 0 |
---|
| 140 | ;; |
---|
| 141 | '--chans') |
---|
| 142 | _roar_channels |
---|
| 143 | return 0 |
---|
| 144 | ;; |
---|
| 145 | '--server') |
---|
| 146 | _roar_server "${COMP_WORDS[COMP_CWORD]}" |
---|
| 147 | return 0 |
---|
| 148 | ;; |
---|
| 149 | *) |
---|
| 150 | ;; |
---|
| 151 | esac |
---|
| 152 | |
---|
| 153 | return 77 |
---|
| 154 | } |
---|
| 155 | |
---|
| 156 | _roar_basecodec() { |
---|
| 157 | case "$1" in |
---|
| 158 | '--codec') |
---|
| 159 | _roar_codec |
---|
| 160 | return 0 |
---|
| 161 | ;; |
---|
| 162 | *) |
---|
| 163 | ;; |
---|
| 164 | esac |
---|
| 165 | |
---|
| 166 | return 77 |
---|
| 167 | } |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | _roar_baseclients() { |
---|
| 171 | local cur prev opts dirs |
---|
| 172 | COMPREPLY=() |
---|
| 173 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 174 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 175 | |
---|
| 176 | dirs="--wave --midi --light --raw --complex --rdtcs" |
---|
| 177 | opts="$dirs --server --rate -R --bits -B --chans -C --codec --rel-id --help" |
---|
| 178 | |
---|
| 179 | [ "${COMP_WORDS[0]}" = "roarmon" ] && opts="$opts --prethru" |
---|
| 180 | |
---|
| 181 | _roar_baseopts "$prev" && return 0; |
---|
| 182 | _roar_basecodec "$prev" && return 0; |
---|
| 183 | |
---|
| 184 | case "${prev}" in |
---|
| 185 | '-R') |
---|
| 186 | _roar_rate |
---|
| 187 | return 0 |
---|
| 188 | ;; |
---|
| 189 | '-B') |
---|
| 190 | _roar_bits |
---|
| 191 | return 0 |
---|
| 192 | ;; |
---|
| 193 | '-C') |
---|
| 194 | _roar_channels |
---|
| 195 | return 0 |
---|
| 196 | ;; |
---|
| 197 | *) |
---|
| 198 | ;; |
---|
| 199 | esac |
---|
| 200 | |
---|
| 201 | _filedir |
---|
| 202 | COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur})) |
---|
| 203 | return 0 |
---|
| 204 | } |
---|
| 205 | complete -F _roar_baseclients roarcat roarmon |
---|
| 206 | |
---|
| 207 | _roarcatplay() { |
---|
| 208 | local cur prev opts |
---|
| 209 | COMPREPLY=() |
---|
| 210 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 211 | |
---|
| 212 | opts="--server --simple --passive --background --verbose --help" |
---|
| 213 | |
---|
| 214 | case "${COMP_WORDS[COMP_CWORD-1]}" in |
---|
| 215 | '--server') |
---|
| 216 | _roar_server "$cur" |
---|
| 217 | return 0 |
---|
| 218 | ;; |
---|
| 219 | *) |
---|
| 220 | ;; |
---|
| 221 | esac |
---|
| 222 | |
---|
| 223 | _filedir |
---|
| 224 | COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur})) |
---|
| 225 | return 0 |
---|
| 226 | } |
---|
| 227 | complete -F _roarcatplay roarcatplay |
---|
| 228 | |
---|
| 229 | _roarvumeter() { |
---|
| 230 | local cur prev opts |
---|
| 231 | COMPREPLY=() |
---|
| 232 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 233 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 234 | |
---|
| 235 | opts="--server --rate --bits --chans --samples --pc --db --beat --lowpass --help" |
---|
| 236 | |
---|
| 237 | _roar_baseopts "$prev" && return 0; |
---|
| 238 | |
---|
| 239 | case "${prev}" in |
---|
| 240 | '--samples') |
---|
| 241 | COMPREPLY=($(compgen -W "5000 50000" -- ${cur})) |
---|
| 242 | return 0 |
---|
| 243 | ;; |
---|
| 244 | '--lowpass') |
---|
| 245 | COMPREPLY=($(compgen -W "100 200 300 400 500" -- ${cur})) |
---|
| 246 | return 0 |
---|
| 247 | ;; |
---|
| 248 | *) |
---|
| 249 | ;; |
---|
| 250 | esac |
---|
| 251 | |
---|
| 252 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
---|
| 253 | return 0 |
---|
| 254 | } |
---|
| 255 | complete -F _roarvumeter roarvumeter |
---|
| 256 | |
---|
| 257 | _roarradio() { |
---|
| 258 | local cur prev opts |
---|
| 259 | COMPREPLY=() |
---|
| 260 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 261 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 262 | |
---|
| 263 | opts="--server --rate --bits --chans --codec --help" |
---|
| 264 | |
---|
| 265 | _roar_baseopts "$prev" && return 0; |
---|
| 266 | _roar_basecodec "$prev" && return 0; |
---|
| 267 | |
---|
| 268 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
---|
| 269 | return 0 |
---|
| 270 | } |
---|
| 271 | complete -F _roarradio roarradio |
---|
| 272 | |
---|
| 273 | _roarvorbis() { |
---|
| 274 | local cur prev opts |
---|
| 275 | COMPREPLY=() |
---|
| 276 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 277 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 278 | |
---|
| 279 | opts="--server --vclt-out --help" |
---|
| 280 | |
---|
| 281 | case "${prev}" in |
---|
| 282 | '--vclt-out') |
---|
| 283 | _filedir |
---|
| 284 | return 0 |
---|
| 285 | ;; |
---|
| 286 | '--server') |
---|
| 287 | _roar_server "$cur" |
---|
| 288 | return 0 |
---|
| 289 | ;; |
---|
| 290 | *) |
---|
| 291 | ;; |
---|
| 292 | esac |
---|
| 293 | |
---|
| 294 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
---|
| 295 | return 0 |
---|
| 296 | } |
---|
| 297 | complete -F _roarvorbis roarvorbis |
---|
| 298 | |
---|
| 299 | |
---|
| 300 | _roarinterconnect() { |
---|
| 301 | local cur prev opts |
---|
| 302 | COMPREPLY=() |
---|
| 303 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 304 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 305 | |
---|
| 306 | opts="--server --remote --type --rate --bits --chans --codec --help" |
---|
| 307 | |
---|
| 308 | _roar_baseopts "$prev" && return 0; |
---|
| 309 | _roar_basecodec "$prev" && return 0; |
---|
| 310 | |
---|
| 311 | case "${prev}" in |
---|
| 312 | '--remote') |
---|
| 313 | _roar_server "$cur" |
---|
| 314 | return 0 |
---|
| 315 | ;; |
---|
| 316 | '--type') |
---|
| 317 | COMPREPLY=($(compgen -W "roar esd bidir filter transmit receive" -- ${cur})) |
---|
| 318 | return 0 |
---|
| 319 | ;; |
---|
| 320 | *) |
---|
| 321 | ;; |
---|
| 322 | esac |
---|
| 323 | |
---|
| 324 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
---|
| 325 | return 0 |
---|
| 326 | } |
---|
| 327 | complete -F _roarinterconnect roarinterconnect |
---|
| 328 | |
---|
| 329 | _roarbidir() { |
---|
| 330 | local cur prev opts |
---|
| 331 | COMPREPLY=() |
---|
| 332 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 333 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 334 | |
---|
| 335 | opts="--server --rate --bits --chans --codec --help" |
---|
| 336 | |
---|
| 337 | _roar_baseopts "$prev" && return 0; |
---|
| 338 | _roar_basecodec "$prev" && return 0; |
---|
| 339 | |
---|
| 340 | _filedir |
---|
| 341 | COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur})) |
---|
| 342 | return 0 |
---|
| 343 | } |
---|
| 344 | complete -F _roarbidir roarbidir roarcatvio roarcatpassfh roarcatsendfile |
---|
| 345 | |
---|
| 346 | _roarcatad() { |
---|
| 347 | local cur prev opts |
---|
| 348 | COMPREPLY=() |
---|
| 349 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 350 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 351 | |
---|
| 352 | opts="--server --rate --bits --chans --help" |
---|
| 353 | |
---|
| 354 | _roar_baseopts "$prev" && return 0; |
---|
| 355 | |
---|
| 356 | _filedir |
---|
| 357 | COMPREPLY=(${COMPREPLY[*]} $(compgen -W "${opts}" -- ${cur})) |
---|
| 358 | return 0 |
---|
| 359 | } |
---|
| 360 | complete -F _roarcatad roarcatad roarcat2sock |
---|
| 361 | |
---|
| 362 | _roarphone() { |
---|
| 363 | local cur prev opts mopts |
---|
| 364 | COMPREPLY=() |
---|
| 365 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 366 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 367 | |
---|
| 368 | mopts="--m-rn --m-nick --m-email --m-hp --m-thumbn --m-loc --m-org" |
---|
| 369 | opts="--server --jumbo-mtu --io-flush --rate --bits --chans --afi-downmix --afi-lowpass --afi-speex-prep --afi-speex-denoise --afi-speex-agc --afi-speex-vad --codec --transcode --driver --device --antiecho --threshold --help $mopts" |
---|
| 370 | |
---|
| 371 | _roar_baseopts "$prev" && return 0; |
---|
| 372 | _roar_basecodec "$prev" && return 0; |
---|
| 373 | |
---|
| 374 | case "${prev}" in |
---|
| 375 | '--jumbo-mtu') |
---|
| 376 | _roar_jumbo_mtu |
---|
| 377 | return 0 |
---|
| 378 | ;; |
---|
| 379 | '--io-flush') |
---|
| 380 | return 0 |
---|
| 381 | ;; |
---|
| 382 | '--afi-lowpass') |
---|
| 383 | return 0 |
---|
| 384 | ;; |
---|
| 385 | '--driver') |
---|
| 386 | return 0 |
---|
| 387 | ;; |
---|
| 388 | '--device') |
---|
| 389 | _filedir |
---|
| 390 | return 0 |
---|
| 391 | ;; |
---|
| 392 | '--antiecho') |
---|
| 393 | COMPREPLY=($(compgen -W "none simple speex roard" -- ${cur})) |
---|
| 394 | return 0 |
---|
| 395 | ;; |
---|
| 396 | '--threshold') |
---|
| 397 | return 0 |
---|
| 398 | ;; |
---|
| 399 | '--m-rn') |
---|
| 400 | return 0 |
---|
| 401 | ;; |
---|
| 402 | '--m-nick') |
---|
| 403 | COMPREPLY=($(compgen -W "$USER" -- ${cur})) |
---|
| 404 | return 0 |
---|
| 405 | ;; |
---|
| 406 | '--m-email') |
---|
| 407 | COMPREPLY=($(compgen -W "$USER@$HOSTNAME" -- ${cur})) |
---|
| 408 | return 0 |
---|
| 409 | ;; |
---|
| 410 | '--m-hp') |
---|
| 411 | return 0 |
---|
| 412 | ;; |
---|
| 413 | '--m-thumbn') |
---|
| 414 | return 0 |
---|
| 415 | ;; |
---|
| 416 | '--m-loc') |
---|
| 417 | return 0 |
---|
| 418 | ;; |
---|
| 419 | '--m-org') |
---|
| 420 | return 0 |
---|
| 421 | ;; |
---|
| 422 | *) |
---|
| 423 | ;; |
---|
| 424 | esac |
---|
| 425 | |
---|
| 426 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
---|
| 427 | return 0 |
---|
| 428 | } |
---|
| 429 | complete -F _roarphone roarphone |
---|
| 430 | |
---|
| 431 | _roarctl() { |
---|
| 432 | local cur prev pprev opts cmds |
---|
| 433 | COMPREPLY=() |
---|
| 434 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 435 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 436 | |
---|
| 437 | pprev="--NX-COMMAND--" |
---|
| 438 | if [ "$COMP_CWORD" -ge 2 ] |
---|
| 439 | then |
---|
| 440 | pprev="${COMP_WORDS[COMP_CWORD-2]}" |
---|
| 441 | fi |
---|
| 442 | |
---|
| 443 | if [ "$COMP_CWORD" -ge 3 ] |
---|
| 444 | then |
---|
| 445 | if [ "${COMP_WORDS[COMP_CWORD-3]}" = 'newvirtual' ] |
---|
| 446 | then |
---|
| 447 | _roar_codec |
---|
| 448 | return 0 |
---|
| 449 | fi |
---|
| 450 | if [ "$COMP_CWORD" -ge 4 ] |
---|
| 451 | then |
---|
| 452 | if [ "${COMP_WORDS[COMP_CWORD-4]}" = 'newvirtual' ] |
---|
| 453 | then |
---|
| 454 | _roar_rate |
---|
| 455 | return 0 |
---|
| 456 | fi |
---|
| 457 | if [ "$COMP_CWORD" -ge 5 ] |
---|
| 458 | then |
---|
| 459 | if [ "${COMP_WORDS[COMP_CWORD-5]}" = 'newvirtual' ] |
---|
| 460 | then |
---|
| 461 | _roar_bits |
---|
| 462 | return 0 |
---|
| 463 | fi |
---|
| 464 | if [ "$COMP_CWORD" -ge 6 ] |
---|
| 465 | then |
---|
| 466 | if [ "${COMP_WORDS[COMP_CWORD-6]}" = 'newvirtual' ] |
---|
| 467 | then |
---|
| 468 | _roar_channels |
---|
| 469 | return 0 |
---|
| 470 | fi |
---|
| 471 | fi |
---|
| 472 | fi |
---|
| 473 | fi |
---|
| 474 | fi |
---|
| 475 | |
---|
| 476 | opts="--server --help --verbose -v --list-aiprofiles" |
---|
| 477 | cmds="help sleep ping whoami listaiprofiles aiprofileget standby off resume on standbymode exit terminate volume flag unflag kick newvirtual metaget metasave metaload serveroinfo listclients liststreams allinfo" |
---|
| 478 | |
---|
| 479 | case "${pprev}" in |
---|
| 480 | 'volume') |
---|
| 481 | COMPREPLY=($(compgen -W "mono stereo 1 2 3 4 5 6 7 8 9" -- ${cur})) |
---|
| 482 | return 0 |
---|
| 483 | ;; |
---|
| 484 | 'flag') |
---|
| 485 | _roar_flag |
---|
| 486 | return 0 |
---|
| 487 | ;; |
---|
| 488 | 'unflag') |
---|
| 489 | _roar_flag |
---|
| 490 | return 0 |
---|
| 491 | ;; |
---|
| 492 | 'kick') |
---|
| 493 | return 0 |
---|
| 494 | ;; |
---|
| 495 | 'newvirtual') |
---|
| 496 | _roar_dir |
---|
| 497 | return 0 |
---|
| 498 | ;; |
---|
| 499 | 'metaget') |
---|
| 500 | _roar_metatype |
---|
| 501 | return 0 |
---|
| 502 | ;; |
---|
| 503 | 'metasave') |
---|
| 504 | _filedir |
---|
| 505 | return 0 |
---|
| 506 | ;; |
---|
| 507 | 'metaload') |
---|
| 508 | _filedir |
---|
| 509 | return 0 |
---|
| 510 | ;; |
---|
| 511 | *) |
---|
| 512 | ;; |
---|
| 513 | esac |
---|
| 514 | |
---|
| 515 | case "${prev}" in |
---|
| 516 | '--server') |
---|
| 517 | _roar_server "$cur" |
---|
| 518 | return 0 |
---|
| 519 | ;; |
---|
| 520 | 'sleep') |
---|
| 521 | return 0 |
---|
| 522 | ;; |
---|
| 523 | 'ping') |
---|
| 524 | return 0 |
---|
| 525 | ;; |
---|
| 526 | 'aiprofileget') |
---|
| 527 | COMPREPLY=($(compgen -W "$(roarctl --list-aiprofiles | grep '^Profile Name *: *' | sed 's/^.*: *//')" -- ${cur})) |
---|
| 528 | return 0 |
---|
| 529 | ;; |
---|
| 530 | 'volume') |
---|
| 531 | return 0 |
---|
| 532 | ;; |
---|
| 533 | 'flag') |
---|
| 534 | return 0 |
---|
| 535 | ;; |
---|
| 536 | 'unflag') |
---|
| 537 | return 0 |
---|
| 538 | ;; |
---|
| 539 | 'kick') |
---|
| 540 | COMPREPLY=($(compgen -W "client stream sample source" -- ${cur})) |
---|
| 541 | return 0 |
---|
| 542 | ;; |
---|
| 543 | 'newvirtual') |
---|
| 544 | return 0 |
---|
| 545 | ;; |
---|
| 546 | 'metaget') |
---|
| 547 | return 0 |
---|
| 548 | ;; |
---|
| 549 | 'metasave') |
---|
| 550 | return 0 |
---|
| 551 | ;; |
---|
| 552 | 'metaload') |
---|
| 553 | return 0 |
---|
| 554 | ;; |
---|
| 555 | *) |
---|
| 556 | ;; |
---|
| 557 | esac |
---|
| 558 | |
---|
| 559 | COMPREPLY=($(compgen -W "${opts} ${cmds}" -- ${cur})) |
---|
| 560 | return 0 |
---|
| 561 | } |
---|
| 562 | |
---|
| 563 | complete -F _roarctl roarctl |
---|
| 564 | |
---|
| 565 | _roard() |
---|
| 566 | { |
---|
| 567 | local cur prev opts |
---|
[5124] | 568 | local opts_misc opts_auth opts_plugins opts_audio opts_stream opts_rolestack opts_output opts_source opts_cf opts_midi opts_light opts_rdtcs opts_x11 opts_server |
---|
[4145] | 569 | COMPREPLY=() |
---|
| 570 | cur="${COMP_WORDS[COMP_CWORD]}" |
---|
| 571 | prev="${COMP_WORDS[COMP_CWORD-1]}" |
---|
| 572 | |
---|
| 573 | # |
---|
| 574 | # The basic options we'll complete. |
---|
| 575 | # |
---|
[5124] | 576 | opts_misc="--daemon --verbose --terminate --start --restart --stop --shutdown --realtime --memlock --chroot --setgid --setuid --sysclocksync --location --description --pidfile --log-syslog --script-postdown" |
---|
| 577 | opts_auth="--guest-acclev --trust-acclev --trust-root --no-trust-root --authfile-gen --authfile-load --authfile-type --authfile-acclev --new-authfile" |
---|
| 578 | opts_plugins="--plugin-load" |
---|
[4145] | 579 | opts_audio="--rate --bits --chans -R -B -C --aiprofile" |
---|
| 580 | opts_stream="--stream-flags" |
---|
[5124] | 581 | opts_rolestack="--list-rolestack --rolestack-push" |
---|
| 582 | opts_output="--odriver --odevice -o -O -oO -oP -oN --list-driver" |
---|
[4145] | 583 | opts_source="--source -s -S -sO -sP -sN --list-sources" |
---|
[5136] | 584 | opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers" |
---|
[4145] | 585 | opts_cf="--list-cf" |
---|
| 586 | opts_midi="--midi-no-console --midi-console-enable --midi-console --ssynth-enable --ssynth-disable" |
---|
| 587 | opts_light="--light-channels" |
---|
| 588 | opts_rdtcs="--rds-pi --rds-ps --rds-pty --rds-tp --rds-ct" |
---|
[5124] | 589 | opts_x11="--x11-display --display" |
---|
| 590 | opts_server="--tcp --unix --decnet -t -u -n -4 -6 -64 --port -p --bind -b --sock --proto --proto-dir --proto-rate --proto-bits --proto-codec --proto-chans --list-proto --list-profiles --proto-profile --proto-aiprofile --list-aiprofiles --new-sock --slp --x11 --jumbo-mtu -G -U --no-listen --client-fh --close-fh --standby --auto-standby" |
---|
[4145] | 591 | |
---|
[5124] | 592 | opts="$opts_misc $opts_auth $opts_plugins $opts_audio $opts_stream $opts_rolestack $opts_output $opts_source $opts_mixer $opts_cf $opts_midi $opts_light $opts_rdtcs $opts_x11 $opts_server --help" |
---|
[4145] | 593 | |
---|
| 594 | |
---|
| 595 | # |
---|
| 596 | # Complete the arguments to some of the basic commands. |
---|
| 597 | # |
---|
| 598 | case "${prev}" in |
---|
| 599 | # DIR/FILE: |
---|
| 600 | '--chroot') |
---|
| 601 | _filedir -d |
---|
| 602 | return 0 |
---|
| 603 | ;; |
---|
| 604 | '--pidfile') |
---|
| 605 | _filedir |
---|
| 606 | return 0 |
---|
| 607 | ;; |
---|
[5124] | 608 | '--script-postdown') |
---|
| 609 | _filedir |
---|
| 610 | return 0 |
---|
| 611 | ;; |
---|
[4145] | 612 | '--plugin-load') |
---|
| 613 | _filedir |
---|
| 614 | return 0 |
---|
| 615 | ;; |
---|
[5124] | 616 | '--authfile-gen'|'--authfile-load') |
---|
| 617 | _filedir |
---|
| 618 | return 0 |
---|
| 619 | ;; |
---|
| 620 | # MemLock: |
---|
| 621 | '--memlock') |
---|
| 622 | COMPREPLY=($(compgen -W "none low medium high nearlyall nearlyallsys allcur all default" -- ${cur})) |
---|
| 623 | return 0 |
---|
| 624 | ;; |
---|
| 625 | # Acclev |
---|
| 626 | '--guest-acclev'|'--trust-acclev'|'--authfile-acclev') |
---|
| 627 | COMPREPLY=($(compgen -W "none idented conctl guest user pwruser all" -- ${cur})) |
---|
| 628 | return 0 |
---|
| 629 | ;; |
---|
| 630 | '--authfile-type') |
---|
| 631 | COMPREPLY=($(compgen -W "roar esd pulse htpasswd xauth" -- ${cur})) |
---|
| 632 | return 0 |
---|
| 633 | ;; |
---|
[4145] | 634 | # String: |
---|
[5124] | 635 | '--location'|'--description') |
---|
[4145] | 636 | return 0 |
---|
| 637 | ;; |
---|
| 638 | # Int: |
---|
| 639 | '--rate'|'-R'|'--proto-rate') |
---|
| 640 | _roar_rate |
---|
| 641 | return 0 |
---|
| 642 | ;; |
---|
| 643 | '--bits'|'-B'|'--proto-bits') |
---|
| 644 | _roar_bits |
---|
| 645 | return 0 |
---|
| 646 | ;; |
---|
| 647 | '--chans'|'-C'|'--proto-chans') |
---|
| 648 | _roar_channels |
---|
| 649 | return 0 |
---|
| 650 | ;; |
---|
| 651 | '--light-channels') |
---|
| 652 | COMPREPLY=($(compgen -W "512 1024 1536 2048 4096 8192" -- ${cur})) |
---|
| 653 | return 0 |
---|
| 654 | ;; |
---|
| 655 | '--jumbo-mtu') |
---|
| 656 | _roar_jumbo_mtu |
---|
| 657 | return 0 |
---|
| 658 | ;; |
---|
| 659 | # C=F: |
---|
| 660 | '--stream-flags') |
---|
| 661 | return 0 |
---|
| 662 | ;; |
---|
[5124] | 663 | # R:A |
---|
| 664 | '--rolestack-push') |
---|
[4145] | 665 | return 0 |
---|
| 666 | ;; |
---|
[5124] | 667 | # driver: |
---|
[4145] | 668 | '--odriver'|'-o') |
---|
| 669 | words=$(roard --list-driver | tail -n +3 | sed 's/^ *//; s/ .*$//') |
---|
| 670 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 671 | return 0 |
---|
| 672 | ;; |
---|
| 673 | # Source: |
---|
| 674 | '--source'|'-s') |
---|
| 675 | words=$(roard --list-sources | tail -n +3 | sed 's/^ *//; s/ .*$//') |
---|
| 676 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 677 | return 0 |
---|
| 678 | ;; |
---|
| 679 | # Device: |
---|
| 680 | # FIXME: add support for non file devices |
---|
| 681 | '--odevice'|'-O') |
---|
| 682 | _filedir |
---|
| 683 | return 0 |
---|
| 684 | ;; |
---|
| 685 | '-S') |
---|
| 686 | _filedir |
---|
| 687 | return 0 |
---|
| 688 | ;; |
---|
| 689 | '--midi-console') |
---|
| 690 | _filedir |
---|
| 691 | return 0 |
---|
| 692 | ;; |
---|
| 693 | # Options: |
---|
| 694 | '-dO') |
---|
| 695 | return 0 |
---|
| 696 | ;; |
---|
| 697 | '-oO') |
---|
| 698 | return 0 |
---|
| 699 | ;; |
---|
| 700 | '-sO') |
---|
| 701 | return 0 |
---|
| 702 | ;; |
---|
| 703 | # RDS: |
---|
| 704 | '--rds-pi') |
---|
| 705 | return 0 |
---|
| 706 | ;; |
---|
| 707 | '--rds-ps') |
---|
| 708 | return 0 |
---|
| 709 | ;; |
---|
| 710 | '--rds-pty') |
---|
| 711 | return 0 |
---|
| 712 | ;; |
---|
[5136] | 713 | # Mixer: |
---|
| 714 | # opts_mixer="-m --mixer -M -mO -mN -mP --list-mixers" |
---|
| 715 | '--mixer'|'-m') |
---|
| 716 | words=$(roard --list-mixers | tail -n +3 | sed 's/^ *//; s/ .*$//') |
---|
| 717 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 718 | return 0 |
---|
| 719 | ;; |
---|
| 720 | '-M') |
---|
| 721 | _filedir |
---|
| 722 | return 0 |
---|
| 723 | ;; |
---|
| 724 | '-mO') |
---|
| 725 | return 0 |
---|
| 726 | ;; |
---|
| 727 | '-mN') |
---|
| 728 | return 0 |
---|
| 729 | ;; |
---|
| 730 | '-mP') |
---|
| 731 | return 0 |
---|
| 732 | ;; |
---|
| 733 | '--list-mixers') |
---|
| 734 | return 0 |
---|
| 735 | ;; |
---|
[5124] | 736 | # X11: |
---|
| 737 | '--x11-display'|'--display') |
---|
| 738 | return 0 |
---|
| 739 | ;; |
---|
[4145] | 740 | # Port: |
---|
| 741 | '--port'|'-p') |
---|
| 742 | COMPREPLY=( $( compgen -s $cur ) ) |
---|
| 743 | return 0 |
---|
| 744 | ;; |
---|
| 745 | # Host/Node/File: |
---|
| 746 | '--bind'|'-b') |
---|
| 747 | COMPREPLY=( $( compgen -A hostname $cur ) "0.0.0.0" ) |
---|
| 748 | return 0 |
---|
| 749 | ;; |
---|
| 750 | '--sock') |
---|
| 751 | _filedir |
---|
| 752 | return 0 |
---|
| 753 | ;; |
---|
| 754 | # Proto: |
---|
| 755 | '--proto') |
---|
| 756 | words=$(roard --list-proto | tail -n +3 | sed 's/^ *//; s/ .*$//') |
---|
| 757 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 758 | return 0 |
---|
| 759 | ;; |
---|
| 760 | '--proto-profile') |
---|
| 761 | words=$(roard --list-profiles | tail -n +3 | sed 's/^ *//; s/ .*$//') |
---|
| 762 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 763 | return 0 |
---|
| 764 | ;; |
---|
| 765 | '--proto-aiprofile'|'--aiprofile') |
---|
| 766 | words=$(roarctl --list-aiprofiles | grep '^Profile Name' | sed 's/^.*: *//') |
---|
| 767 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 768 | return 0 |
---|
| 769 | ;; |
---|
| 770 | # FH: |
---|
| 771 | '--client-fh') |
---|
| 772 | words=$(command ls /proc/self/fd 2> /dev/null) |
---|
| 773 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 774 | return 0 |
---|
| 775 | ;; |
---|
| 776 | '--close-fh') |
---|
| 777 | words=$(command ls /proc/self/fd 2> /dev/null) |
---|
| 778 | COMPREPLY=($(compgen -W "${words}" -- ${cur})) |
---|
| 779 | return 0 |
---|
| 780 | ;; |
---|
| 781 | # Dir: |
---|
| 782 | '--proto-dir') |
---|
| 783 | _roar_dir |
---|
| 784 | return 0; |
---|
| 785 | ;; |
---|
| 786 | # Codec: |
---|
| 787 | '--proto-codec') |
---|
| 788 | _roar_codec |
---|
| 789 | return 0; |
---|
| 790 | ;; |
---|
| 791 | |
---|
| 792 | *) |
---|
| 793 | ;; |
---|
| 794 | esac |
---|
| 795 | |
---|
| 796 | COMPREPLY=($(compgen -W "${opts}" -- ${cur})) |
---|
| 797 | return 0 |
---|
| 798 | } |
---|
| 799 | complete -F _roard roard |
---|
| 800 | |
---|
| 801 | complete -F _command roarify |
---|
| 802 | |
---|
| 803 | # vim:ft=sh: |
---|
| 804 | |
---|
| 805 | #ll |
---|