diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-07 16:16:01 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-07 16:16:01 +0200 |
| commit | 03f4585424d05dd50022759c7ad098fe06277f6e (patch) | |
| tree | 8b6e8a829afbfa949f7a55eaf5620ea99b17bf40 /completions/rsp.bash | |
| parent | Add toggle command to resume/pause playback and fix queue display bug (diff) | |
| download | rsplayer-03f4585424d05dd50022759c7ad098fe06277f6e.tar.gz rsplayer-03f4585424d05dd50022759c7ad098fe06277f6e.zip | |
Fix queue bugs: play -i on empty queue, stale track replay after queue ends, shuffle preserving current position
- insert_after_current: guard against panic on empty queue
- play -i (now): skip position increment when queue was empty so track plays
- directory last: use audio.is_playing() instead of q.current() to avoid replaying finished track
- shuffle: only randomize tracks after current position
Diffstat (limited to '')
| -rw-r--r-- | completions/rsp.bash | 920 |
1 files changed, 906 insertions, 14 deletions
diff --git a/completions/rsp.bash b/completions/rsp.bash index b625927..4ea8603 100644 --- a/completions/rsp.bash +++ b/completions/rsp.bash | |||
| @@ -1,26 +1,918 @@ | |||
| 1 | #!/usr/bin/env bash | 1 | _rsp_play_query_completions() { |
| 2 | local cur="${COMP_WORDS[COMP_CWORD]}" | ||
| 3 | # Only do dynamic completion if COMPREPLY is empty (no flag matched) | ||
| 4 | # and the current word doesn't start with - | ||
| 5 | if [[ ${#COMPREPLY[@]} -eq 0 && "$cur" != -* ]]; then | ||
| 6 | local -a artists | ||
| 7 | artists=($(rsp play --list 2>/dev/null)) | ||
| 8 | COMPREPLY=( $(compgen -W "${artists[*]}" -- "$cur") ) | ||
| 9 | fi | ||
| 10 | } | ||
| 2 | 11 | ||
| 3 | _rsp() { | 12 | _rsp() { |
| 4 | local cur prev words cword | 13 | local i cur prev opts cmd |
| 5 | _init_completion || return | 14 | COMPREPLY=() |
| 15 | if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then | ||
| 16 | cur="$2" | ||
| 17 | else | ||
| 18 | cur="${COMP_WORDS[COMP_CWORD]}" | ||
| 19 | fi | ||
| 20 | prev="$3" | ||
| 21 | cmd="" | ||
| 22 | opts="" | ||
| 23 | |||
| 24 | for i in "${COMP_WORDS[@]:0:COMP_CWORD}" | ||
| 25 | do | ||
| 26 | case "${cmd},${i}" in | ||
| 27 | ",$1") | ||
| 28 | cmd="rsp" | ||
| 29 | ;; | ||
| 30 | rsp,completions) | ||
| 31 | cmd="rsp__subcmd__completions" | ||
| 32 | ;; | ||
| 33 | rsp,help) | ||
| 34 | cmd="rsp__subcmd__help" | ||
| 35 | ;; | ||
| 36 | rsp,next) | ||
| 37 | cmd="rsp__subcmd__next" | ||
| 38 | ;; | ||
| 39 | rsp,pause) | ||
| 40 | cmd="rsp__subcmd__pause" | ||
| 41 | ;; | ||
| 42 | rsp,play) | ||
| 43 | cmd="rsp__subcmd__play" | ||
| 44 | ;; | ||
| 45 | rsp,previous) | ||
| 46 | cmd="rsp__subcmd__previous" | ||
| 47 | ;; | ||
| 48 | rsp,queue) | ||
| 49 | cmd="rsp__subcmd__queue" | ||
| 50 | ;; | ||
| 51 | rsp,restart) | ||
| 52 | cmd="rsp__subcmd__restart" | ||
| 53 | ;; | ||
| 54 | rsp,resume) | ||
| 55 | cmd="rsp__subcmd__resume" | ||
| 56 | ;; | ||
| 57 | rsp,scan) | ||
| 58 | cmd="rsp__subcmd__scan" | ||
| 59 | ;; | ||
| 60 | rsp,settings) | ||
| 61 | cmd="rsp__subcmd__settings" | ||
| 62 | ;; | ||
| 63 | rsp,shuffle) | ||
| 64 | cmd="rsp__subcmd__shuffle" | ||
| 65 | ;; | ||
| 66 | rsp,start) | ||
| 67 | cmd="rsp__subcmd__start" | ||
| 68 | ;; | ||
| 69 | rsp,status) | ||
| 70 | cmd="rsp__subcmd__status" | ||
| 71 | ;; | ||
| 72 | rsp,stop) | ||
| 73 | cmd="rsp__subcmd__stop" | ||
| 74 | ;; | ||
| 75 | rsp,stop-playback) | ||
| 76 | cmd="rsp__subcmd__stop__subcmd__playback" | ||
| 77 | ;; | ||
| 78 | rsp,toggle) | ||
| 79 | cmd="rsp__subcmd__toggle" | ||
| 80 | ;; | ||
| 81 | rsp,volume) | ||
| 82 | cmd="rsp__subcmd__volume" | ||
| 83 | ;; | ||
| 84 | rsp__subcmd__help,completions) | ||
| 85 | cmd="rsp__subcmd__help__subcmd__completions" | ||
| 86 | ;; | ||
| 87 | rsp__subcmd__help,help) | ||
| 88 | cmd="rsp__subcmd__help__subcmd__help" | ||
| 89 | ;; | ||
| 90 | rsp__subcmd__help,next) | ||
| 91 | cmd="rsp__subcmd__help__subcmd__next" | ||
| 92 | ;; | ||
| 93 | rsp__subcmd__help,pause) | ||
| 94 | cmd="rsp__subcmd__help__subcmd__pause" | ||
| 95 | ;; | ||
| 96 | rsp__subcmd__help,play) | ||
| 97 | cmd="rsp__subcmd__help__subcmd__play" | ||
| 98 | ;; | ||
| 99 | rsp__subcmd__help,previous) | ||
| 100 | cmd="rsp__subcmd__help__subcmd__previous" | ||
| 101 | ;; | ||
| 102 | rsp__subcmd__help,queue) | ||
| 103 | cmd="rsp__subcmd__help__subcmd__queue" | ||
| 104 | ;; | ||
| 105 | rsp__subcmd__help,restart) | ||
| 106 | cmd="rsp__subcmd__help__subcmd__restart" | ||
| 107 | ;; | ||
| 108 | rsp__subcmd__help,resume) | ||
| 109 | cmd="rsp__subcmd__help__subcmd__resume" | ||
| 110 | ;; | ||
| 111 | rsp__subcmd__help,scan) | ||
| 112 | cmd="rsp__subcmd__help__subcmd__scan" | ||
| 113 | ;; | ||
| 114 | rsp__subcmd__help,settings) | ||
| 115 | cmd="rsp__subcmd__help__subcmd__settings" | ||
| 116 | ;; | ||
| 117 | rsp__subcmd__help,shuffle) | ||
| 118 | cmd="rsp__subcmd__help__subcmd__shuffle" | ||
| 119 | ;; | ||
| 120 | rsp__subcmd__help,start) | ||
| 121 | cmd="rsp__subcmd__help__subcmd__start" | ||
| 122 | ;; | ||
| 123 | rsp__subcmd__help,status) | ||
| 124 | cmd="rsp__subcmd__help__subcmd__status" | ||
| 125 | ;; | ||
| 126 | rsp__subcmd__help,stop) | ||
| 127 | cmd="rsp__subcmd__help__subcmd__stop" | ||
| 128 | ;; | ||
| 129 | rsp__subcmd__help,stop-playback) | ||
| 130 | cmd="rsp__subcmd__help__subcmd__stop__subcmd__playback" | ||
| 131 | ;; | ||
| 132 | rsp__subcmd__help,toggle) | ||
| 133 | cmd="rsp__subcmd__help__subcmd__toggle" | ||
| 134 | ;; | ||
| 135 | rsp__subcmd__help,volume) | ||
| 136 | cmd="rsp__subcmd__help__subcmd__volume" | ||
| 137 | ;; | ||
| 138 | rsp__subcmd__help__subcmd__settings,get) | ||
| 139 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__get" | ||
| 140 | ;; | ||
| 141 | rsp__subcmd__help__subcmd__settings,list) | ||
| 142 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__list" | ||
| 143 | ;; | ||
| 144 | rsp__subcmd__help__subcmd__settings,set) | ||
| 145 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__set" | ||
| 146 | ;; | ||
| 147 | rsp__subcmd__help__subcmd__settings,unset) | ||
| 148 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__unset" | ||
| 149 | ;; | ||
| 150 | rsp__subcmd__settings,get) | ||
| 151 | cmd="rsp__subcmd__settings__subcmd__get" | ||
| 152 | ;; | ||
| 153 | rsp__subcmd__settings,help) | ||
| 154 | cmd="rsp__subcmd__settings__subcmd__help" | ||
| 155 | ;; | ||
| 156 | rsp__subcmd__settings,list) | ||
| 157 | cmd="rsp__subcmd__settings__subcmd__list" | ||
| 158 | ;; | ||
| 159 | rsp__subcmd__settings,set) | ||
| 160 | cmd="rsp__subcmd__settings__subcmd__set" | ||
| 161 | ;; | ||
| 162 | rsp__subcmd__settings,unset) | ||
| 163 | cmd="rsp__subcmd__settings__subcmd__unset" | ||
| 164 | ;; | ||
| 165 | rsp__subcmd__settings__subcmd__help,get) | ||
| 166 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__get" | ||
| 167 | ;; | ||
| 168 | rsp__subcmd__settings__subcmd__help,help) | ||
| 169 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__help" | ||
| 170 | ;; | ||
| 171 | rsp__subcmd__settings__subcmd__help,list) | ||
| 172 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__list" | ||
| 173 | ;; | ||
| 174 | rsp__subcmd__settings__subcmd__help,set) | ||
| 175 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__set" | ||
| 176 | ;; | ||
| 177 | rsp__subcmd__settings__subcmd__help,unset) | ||
| 178 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__unset" | ||
| 179 | ;; | ||
| 180 | *) | ||
| 181 | ;; | ||
| 182 | esac | ||
| 183 | done | ||
| 6 | 184 | ||
| 7 | case $prev in | 185 | case "${cmd}" in |
| 8 | rsp) | 186 | rsp) |
| 9 | COMPREPLY=($(compgen -W "start stop restart play pause resume toggle next previous volume shuffle queue status scan settings" -- "$cur")) | 187 | opts="-h --help start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" |
| 188 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then | ||
| 189 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 190 | return 0 | ||
| 191 | fi | ||
| 192 | case "${prev}" in | ||
| 193 | *) | ||
| 194 | COMPREPLY=() | ||
| 195 | ;; | ||
| 196 | esac | ||
| 197 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 198 | return 0 | ||
| 199 | ;; | ||
| 200 | rsp__subcmd__completions) | ||
| 201 | opts="-h --shell --help" | ||
| 202 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 203 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 204 | return 0 | ||
| 205 | fi | ||
| 206 | case "${prev}" in | ||
| 207 | --shell) | ||
| 208 | COMPREPLY=($(compgen -W "bash elvish fish powershell zsh" -- "${cur}")) | ||
| 209 | return 0 | ||
| 210 | ;; | ||
| 211 | *) | ||
| 212 | COMPREPLY=() | ||
| 213 | ;; | ||
| 214 | esac | ||
| 215 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 216 | return 0 | ||
| 217 | ;; | ||
| 218 | rsp__subcmd__help) | ||
| 219 | opts="start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" | ||
| 220 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 221 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 222 | return 0 | ||
| 223 | fi | ||
| 224 | case "${prev}" in | ||
| 225 | *) | ||
| 226 | COMPREPLY=() | ||
| 227 | ;; | ||
| 228 | esac | ||
| 229 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 230 | return 0 | ||
| 231 | ;; | ||
| 232 | rsp__subcmd__help__subcmd__completions) | ||
| 233 | opts="" | ||
| 234 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 235 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 236 | return 0 | ||
| 237 | fi | ||
| 238 | case "${prev}" in | ||
| 239 | *) | ||
| 240 | COMPREPLY=() | ||
| 241 | ;; | ||
| 242 | esac | ||
| 243 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 244 | return 0 | ||
| 245 | ;; | ||
| 246 | rsp__subcmd__help__subcmd__help) | ||
| 247 | opts="" | ||
| 248 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 249 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 250 | return 0 | ||
| 251 | fi | ||
| 252 | case "${prev}" in | ||
| 253 | *) | ||
| 254 | COMPREPLY=() | ||
| 255 | ;; | ||
| 256 | esac | ||
| 257 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 258 | return 0 | ||
| 259 | ;; | ||
| 260 | rsp__subcmd__help__subcmd__next) | ||
| 261 | opts="" | ||
| 262 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 263 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 264 | return 0 | ||
| 265 | fi | ||
| 266 | case "${prev}" in | ||
| 267 | *) | ||
| 268 | COMPREPLY=() | ||
| 269 | ;; | ||
| 270 | esac | ||
| 271 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 272 | return 0 | ||
| 273 | ;; | ||
| 274 | rsp__subcmd__help__subcmd__pause) | ||
| 275 | opts="" | ||
| 276 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 277 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 278 | return 0 | ||
| 279 | fi | ||
| 280 | case "${prev}" in | ||
| 281 | *) | ||
| 282 | COMPREPLY=() | ||
| 283 | ;; | ||
| 284 | esac | ||
| 285 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 286 | return 0 | ||
| 287 | ;; | ||
| 288 | rsp__subcmd__help__subcmd__play) | ||
| 289 | opts="" | ||
| 290 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 291 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 292 | return 0 | ||
| 293 | fi | ||
| 294 | case "${prev}" in | ||
| 295 | *) | ||
| 296 | COMPREPLY=() | ||
| 297 | ;; | ||
| 298 | esac | ||
| 299 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 300 | return 0 | ||
| 301 | ;; | ||
| 302 | rsp__subcmd__help__subcmd__previous) | ||
| 303 | opts="" | ||
| 304 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 305 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 306 | return 0 | ||
| 307 | fi | ||
| 308 | case "${prev}" in | ||
| 309 | *) | ||
| 310 | COMPREPLY=() | ||
| 311 | ;; | ||
| 312 | esac | ||
| 313 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 314 | return 0 | ||
| 315 | ;; | ||
| 316 | rsp__subcmd__help__subcmd__queue) | ||
| 317 | opts="" | ||
| 318 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 319 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 320 | return 0 | ||
| 321 | fi | ||
| 322 | case "${prev}" in | ||
| 323 | *) | ||
| 324 | COMPREPLY=() | ||
| 325 | ;; | ||
| 326 | esac | ||
| 327 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 328 | return 0 | ||
| 329 | ;; | ||
| 330 | rsp__subcmd__help__subcmd__restart) | ||
| 331 | opts="" | ||
| 332 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 333 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 334 | return 0 | ||
| 335 | fi | ||
| 336 | case "${prev}" in | ||
| 337 | *) | ||
| 338 | COMPREPLY=() | ||
| 339 | ;; | ||
| 340 | esac | ||
| 341 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 342 | return 0 | ||
| 343 | ;; | ||
| 344 | rsp__subcmd__help__subcmd__resume) | ||
| 345 | opts="" | ||
| 346 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 347 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 348 | return 0 | ||
| 349 | fi | ||
| 350 | case "${prev}" in | ||
| 351 | *) | ||
| 352 | COMPREPLY=() | ||
| 353 | ;; | ||
| 354 | esac | ||
| 355 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 356 | return 0 | ||
| 357 | ;; | ||
| 358 | rsp__subcmd__help__subcmd__scan) | ||
| 359 | opts="" | ||
| 360 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 361 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 362 | return 0 | ||
| 363 | fi | ||
| 364 | case "${prev}" in | ||
| 365 | *) | ||
| 366 | COMPREPLY=() | ||
| 367 | ;; | ||
| 368 | esac | ||
| 369 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 370 | return 0 | ||
| 371 | ;; | ||
| 372 | rsp__subcmd__help__subcmd__settings) | ||
| 373 | opts="get set list unset" | ||
| 374 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 375 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 376 | return 0 | ||
| 377 | fi | ||
| 378 | case "${prev}" in | ||
| 379 | *) | ||
| 380 | COMPREPLY=() | ||
| 381 | ;; | ||
| 382 | esac | ||
| 383 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 384 | return 0 | ||
| 385 | ;; | ||
| 386 | rsp__subcmd__help__subcmd__settings__subcmd__get) | ||
| 387 | opts="" | ||
| 388 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 389 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 390 | return 0 | ||
| 391 | fi | ||
| 392 | case "${prev}" in | ||
| 393 | *) | ||
| 394 | COMPREPLY=() | ||
| 395 | ;; | ||
| 396 | esac | ||
| 397 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 398 | return 0 | ||
| 399 | ;; | ||
| 400 | rsp__subcmd__help__subcmd__settings__subcmd__list) | ||
| 401 | opts="" | ||
| 402 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 403 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 404 | return 0 | ||
| 405 | fi | ||
| 406 | case "${prev}" in | ||
| 407 | *) | ||
| 408 | COMPREPLY=() | ||
| 409 | ;; | ||
| 410 | esac | ||
| 411 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 412 | return 0 | ||
| 413 | ;; | ||
| 414 | rsp__subcmd__help__subcmd__settings__subcmd__set) | ||
| 415 | opts="" | ||
| 416 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 417 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 418 | return 0 | ||
| 419 | fi | ||
| 420 | case "${prev}" in | ||
| 421 | *) | ||
| 422 | COMPREPLY=() | ||
| 423 | ;; | ||
| 424 | esac | ||
| 425 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 426 | return 0 | ||
| 427 | ;; | ||
| 428 | rsp__subcmd__help__subcmd__settings__subcmd__unset) | ||
| 429 | opts="" | ||
| 430 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 431 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 432 | return 0 | ||
| 433 | fi | ||
| 434 | case "${prev}" in | ||
| 435 | *) | ||
| 436 | COMPREPLY=() | ||
| 437 | ;; | ||
| 438 | esac | ||
| 439 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 440 | return 0 | ||
| 441 | ;; | ||
| 442 | rsp__subcmd__help__subcmd__shuffle) | ||
| 443 | opts="" | ||
| 444 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 445 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 446 | return 0 | ||
| 447 | fi | ||
| 448 | case "${prev}" in | ||
| 449 | *) | ||
| 450 | COMPREPLY=() | ||
| 451 | ;; | ||
| 452 | esac | ||
| 453 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 454 | return 0 | ||
| 455 | ;; | ||
| 456 | rsp__subcmd__help__subcmd__start) | ||
| 457 | opts="" | ||
| 458 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 459 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 460 | return 0 | ||
| 461 | fi | ||
| 462 | case "${prev}" in | ||
| 463 | *) | ||
| 464 | COMPREPLY=() | ||
| 465 | ;; | ||
| 466 | esac | ||
| 467 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 468 | return 0 | ||
| 469 | ;; | ||
| 470 | rsp__subcmd__help__subcmd__status) | ||
| 471 | opts="" | ||
| 472 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 473 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 474 | return 0 | ||
| 475 | fi | ||
| 476 | case "${prev}" in | ||
| 477 | *) | ||
| 478 | COMPREPLY=() | ||
| 479 | ;; | ||
| 480 | esac | ||
| 481 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 482 | return 0 | ||
| 483 | ;; | ||
| 484 | rsp__subcmd__help__subcmd__stop) | ||
| 485 | opts="" | ||
| 486 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 487 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 488 | return 0 | ||
| 489 | fi | ||
| 490 | case "${prev}" in | ||
| 491 | *) | ||
| 492 | COMPREPLY=() | ||
| 493 | ;; | ||
| 494 | esac | ||
| 495 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 496 | return 0 | ||
| 497 | ;; | ||
| 498 | rsp__subcmd__help__subcmd__stop__subcmd__playback) | ||
| 499 | opts="" | ||
| 500 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 501 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 502 | return 0 | ||
| 503 | fi | ||
| 504 | case "${prev}" in | ||
| 505 | *) | ||
| 506 | COMPREPLY=() | ||
| 507 | ;; | ||
| 508 | esac | ||
| 509 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 510 | return 0 | ||
| 511 | ;; | ||
| 512 | rsp__subcmd__help__subcmd__toggle) | ||
| 513 | opts="" | ||
| 514 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 515 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 516 | return 0 | ||
| 517 | fi | ||
| 518 | case "${prev}" in | ||
| 519 | *) | ||
| 520 | COMPREPLY=() | ||
| 521 | ;; | ||
| 522 | esac | ||
| 523 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 524 | return 0 | ||
| 525 | ;; | ||
| 526 | rsp__subcmd__help__subcmd__volume) | ||
| 527 | opts="" | ||
| 528 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 529 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 530 | return 0 | ||
| 531 | fi | ||
| 532 | case "${prev}" in | ||
| 533 | *) | ||
| 534 | COMPREPLY=() | ||
| 535 | ;; | ||
| 536 | esac | ||
| 537 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 538 | return 0 | ||
| 539 | ;; | ||
| 540 | rsp__subcmd__next) | ||
| 541 | opts="-h --help" | ||
| 542 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 543 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 544 | return 0 | ||
| 545 | fi | ||
| 546 | case "${prev}" in | ||
| 547 | *) | ||
| 548 | COMPREPLY=() | ||
| 549 | ;; | ||
| 550 | esac | ||
| 551 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 552 | return 0 | ||
| 553 | ;; | ||
| 554 | rsp__subcmd__pause) | ||
| 555 | opts="-h --help" | ||
| 556 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 557 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 558 | return 0 | ||
| 559 | fi | ||
| 560 | case "${prev}" in | ||
| 561 | *) | ||
| 562 | COMPREPLY=() | ||
| 563 | ;; | ||
| 564 | esac | ||
| 565 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 566 | return 0 | ||
| 567 | ;; | ||
| 568 | rsp__subcmd__play) | ||
| 569 | opts="-i -n -l -L -h --now --next --last --list --help [QUERY]" | ||
| 570 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 571 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 572 | return 0 | ||
| 573 | fi | ||
| 574 | case "${prev}" in | ||
| 575 | *) | ||
| 576 | COMPREPLY=() | ||
| 577 | ;; | ||
| 578 | esac | ||
| 579 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 580 | |||
| 581 | # Dynamic artist/album completion for query argument | ||
| 582 | _rsp_play_query_completions | ||
| 583 | return 0 | ||
| 584 | ;; | ||
| 585 | rsp__subcmd__previous) | ||
| 586 | opts="-h --help" | ||
| 587 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 588 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 589 | return 0 | ||
| 590 | fi | ||
| 591 | case "${prev}" in | ||
| 592 | *) | ||
| 593 | COMPREPLY=() | ||
| 594 | ;; | ||
| 595 | esac | ||
| 596 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 597 | return 0 | ||
| 598 | ;; | ||
| 599 | rsp__subcmd__queue) | ||
| 600 | opts="-h --help [POSITION] [QUERY]" | ||
| 601 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 602 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 603 | return 0 | ||
| 604 | fi | ||
| 605 | case "${prev}" in | ||
| 606 | *) | ||
| 607 | COMPREPLY=() | ||
| 608 | ;; | ||
| 609 | esac | ||
| 610 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 611 | return 0 | ||
| 612 | ;; | ||
| 613 | rsp__subcmd__restart) | ||
| 614 | opts="-h --help" | ||
| 615 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 616 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 617 | return 0 | ||
| 618 | fi | ||
| 619 | case "${prev}" in | ||
| 620 | *) | ||
| 621 | COMPREPLY=() | ||
| 622 | ;; | ||
| 623 | esac | ||
| 624 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 625 | return 0 | ||
| 626 | ;; | ||
| 627 | rsp__subcmd__resume) | ||
| 628 | opts="-h --help" | ||
| 629 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 630 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 631 | return 0 | ||
| 632 | fi | ||
| 633 | case "${prev}" in | ||
| 634 | *) | ||
| 635 | COMPREPLY=() | ||
| 636 | ;; | ||
| 637 | esac | ||
| 638 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 639 | return 0 | ||
| 640 | ;; | ||
| 641 | rsp__subcmd__scan) | ||
| 642 | opts="-h --force --paths --help" | ||
| 643 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 644 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 645 | return 0 | ||
| 646 | fi | ||
| 647 | case "${prev}" in | ||
| 648 | --paths) | ||
| 649 | COMPREPLY=($(compgen -f "${cur}")) | ||
| 650 | return 0 | ||
| 651 | ;; | ||
| 652 | *) | ||
| 653 | COMPREPLY=() | ||
| 654 | ;; | ||
| 655 | esac | ||
| 656 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 657 | return 0 | ||
| 658 | ;; | ||
| 659 | rsp__subcmd__settings) | ||
| 660 | opts="-h --help get set list unset help" | ||
| 661 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 662 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 663 | return 0 | ||
| 664 | fi | ||
| 665 | case "${prev}" in | ||
| 666 | *) | ||
| 667 | COMPREPLY=() | ||
| 668 | ;; | ||
| 669 | esac | ||
| 670 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 671 | return 0 | ||
| 672 | ;; | ||
| 673 | rsp__subcmd__settings__subcmd__get) | ||
| 674 | opts="-h --help <KEY>" | ||
| 675 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 676 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 677 | return 0 | ||
| 678 | fi | ||
| 679 | case "${prev}" in | ||
| 680 | *) | ||
| 681 | COMPREPLY=() | ||
| 682 | ;; | ||
| 683 | esac | ||
| 684 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 685 | return 0 | ||
| 686 | ;; | ||
| 687 | rsp__subcmd__settings__subcmd__help) | ||
| 688 | opts="get set list unset help" | ||
| 689 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 690 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 691 | return 0 | ||
| 692 | fi | ||
| 693 | case "${prev}" in | ||
| 694 | *) | ||
| 695 | COMPREPLY=() | ||
| 696 | ;; | ||
| 697 | esac | ||
| 698 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 699 | return 0 | ||
| 700 | ;; | ||
| 701 | rsp__subcmd__settings__subcmd__help__subcmd__get) | ||
| 702 | opts="" | ||
| 703 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 704 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 705 | return 0 | ||
| 706 | fi | ||
| 707 | case "${prev}" in | ||
| 708 | *) | ||
| 709 | COMPREPLY=() | ||
| 710 | ;; | ||
| 711 | esac | ||
| 712 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 713 | return 0 | ||
| 714 | ;; | ||
| 715 | rsp__subcmd__settings__subcmd__help__subcmd__help) | ||
| 716 | opts="" | ||
| 717 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 718 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 719 | return 0 | ||
| 720 | fi | ||
| 721 | case "${prev}" in | ||
| 722 | *) | ||
| 723 | COMPREPLY=() | ||
| 724 | ;; | ||
| 725 | esac | ||
| 726 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 727 | return 0 | ||
| 728 | ;; | ||
| 729 | rsp__subcmd__settings__subcmd__help__subcmd__list) | ||
| 730 | opts="" | ||
| 731 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 732 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 733 | return 0 | ||
| 734 | fi | ||
| 735 | case "${prev}" in | ||
| 736 | *) | ||
| 737 | COMPREPLY=() | ||
| 738 | ;; | ||
| 739 | esac | ||
| 740 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 741 | return 0 | ||
| 742 | ;; | ||
| 743 | rsp__subcmd__settings__subcmd__help__subcmd__set) | ||
| 744 | opts="" | ||
| 745 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 746 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 747 | return 0 | ||
| 748 | fi | ||
| 749 | case "${prev}" in | ||
| 750 | *) | ||
| 751 | COMPREPLY=() | ||
| 752 | ;; | ||
| 753 | esac | ||
| 754 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 755 | return 0 | ||
| 756 | ;; | ||
| 757 | rsp__subcmd__settings__subcmd__help__subcmd__unset) | ||
| 758 | opts="" | ||
| 759 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 760 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 761 | return 0 | ||
| 762 | fi | ||
| 763 | case "${prev}" in | ||
| 764 | *) | ||
| 765 | COMPREPLY=() | ||
| 766 | ;; | ||
| 767 | esac | ||
| 768 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 769 | return 0 | ||
| 770 | ;; | ||
| 771 | rsp__subcmd__settings__subcmd__list) | ||
| 772 | opts="-h --help" | ||
| 773 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 774 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 775 | return 0 | ||
| 776 | fi | ||
| 777 | case "${prev}" in | ||
| 778 | *) | ||
| 779 | COMPREPLY=() | ||
| 780 | ;; | ||
| 781 | esac | ||
| 782 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 783 | return 0 | ||
| 784 | ;; | ||
| 785 | rsp__subcmd__settings__subcmd__set) | ||
| 786 | opts="-h --help <KEY> <VALUE>" | ||
| 787 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 788 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 789 | return 0 | ||
| 790 | fi | ||
| 791 | case "${prev}" in | ||
| 792 | *) | ||
| 793 | COMPREPLY=() | ||
| 794 | ;; | ||
| 795 | esac | ||
| 796 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 797 | return 0 | ||
| 798 | ;; | ||
| 799 | rsp__subcmd__settings__subcmd__unset) | ||
| 800 | opts="-h --help <KEY>" | ||
| 801 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 802 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 803 | return 0 | ||
| 804 | fi | ||
| 805 | case "${prev}" in | ||
| 806 | *) | ||
| 807 | COMPREPLY=() | ||
| 808 | ;; | ||
| 809 | esac | ||
| 810 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 811 | return 0 | ||
| 812 | ;; | ||
| 813 | rsp__subcmd__shuffle) | ||
| 814 | opts="-h --help [MODE]" | ||
| 815 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 816 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 817 | return 0 | ||
| 818 | fi | ||
| 819 | case "${prev}" in | ||
| 820 | *) | ||
| 821 | COMPREPLY=() | ||
| 822 | ;; | ||
| 823 | esac | ||
| 824 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 825 | return 0 | ||
| 826 | ;; | ||
| 827 | rsp__subcmd__start) | ||
| 828 | opts="-h --help" | ||
| 829 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 830 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 831 | return 0 | ||
| 832 | fi | ||
| 833 | case "${prev}" in | ||
| 834 | *) | ||
| 835 | COMPREPLY=() | ||
| 836 | ;; | ||
| 837 | esac | ||
| 838 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 839 | return 0 | ||
| 840 | ;; | ||
| 841 | rsp__subcmd__status) | ||
| 842 | opts="-h --help" | ||
| 843 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 844 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 845 | return 0 | ||
| 846 | fi | ||
| 847 | case "${prev}" in | ||
| 848 | *) | ||
| 849 | COMPREPLY=() | ||
| 850 | ;; | ||
| 851 | esac | ||
| 852 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 853 | return 0 | ||
| 10 | ;; | 854 | ;; |
| 11 | play) | 855 | rsp__subcmd__stop) |
| 12 | _filedir | 856 | opts="-h --help" |
| 857 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 858 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 859 | return 0 | ||
| 860 | fi | ||
| 861 | case "${prev}" in | ||
| 862 | *) | ||
| 863 | COMPREPLY=() | ||
| 864 | ;; | ||
| 865 | esac | ||
| 866 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 867 | return 0 | ||
| 13 | ;; | 868 | ;; |
| 14 | volume) | 869 | rsp__subcmd__stop__subcmd__playback) |
| 15 | COMPREPLY=($(compgen -W "0 10 20 30 40 50 60 70 80 90 100" -- "$cur")) | 870 | opts="-h --help" |
| 871 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 872 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 873 | return 0 | ||
| 874 | fi | ||
| 875 | case "${prev}" in | ||
| 876 | *) | ||
| 877 | COMPREPLY=() | ||
| 878 | ;; | ||
| 879 | esac | ||
| 880 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 881 | return 0 | ||
| 16 | ;; | 882 | ;; |
| 17 | shuffle) | 883 | rsp__subcmd__toggle) |
| 18 | COMPREPLY=($(compgen -W "on off album" -- "$cur")) | 884 | opts="-h --help" |
| 885 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 886 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 887 | return 0 | ||
| 888 | fi | ||
| 889 | case "${prev}" in | ||
| 890 | *) | ||
| 891 | COMPREPLY=() | ||
| 892 | ;; | ||
| 893 | esac | ||
| 894 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 895 | return 0 | ||
| 19 | ;; | 896 | ;; |
| 20 | settings) | 897 | rsp__subcmd__volume) |
| 21 | COMPREPLY=($(compgen -W "get set list unset" -- "$cur")) | 898 | opts="-h --help [LEVEL]" |
| 899 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 900 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 901 | return 0 | ||
| 902 | fi | ||
| 903 | case "${prev}" in | ||
| 904 | *) | ||
| 905 | COMPREPLY=() | ||
| 906 | ;; | ||
| 907 | esac | ||
| 908 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 909 | return 0 | ||
| 22 | ;; | 910 | ;; |
| 23 | esac | 911 | esac |
| 24 | } | 912 | } |
| 25 | 913 | ||
| 26 | complete -F _rsp rsp | 914 | if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then |
| 915 | complete -F _rsp -o nosort -o bashdefault -o default rsp | ||
| 916 | else | ||
| 917 | complete -F _rsp -o bashdefault -o default rsp | ||
| 918 | fi | ||
