diff options
| author | salmonik <raisersoft@proton.me> | 2026-05-26 07:01:40 +0200 |
|---|---|---|
| committer | salmonik <raisersoft@proton.me> | 2026-05-26 07:01:40 +0200 |
| commit | b5872054f641bb417bd1ffc6a9ded1d95181b943 (patch) | |
| tree | 47f129d5b5f984ebb96b6bb2ad274342e0e8c40e | |
| parent | bin size optimizations and queue stopping at the end of it (diff) | |
| download | rsplayer-b5872054f641bb417bd1ffc6a9ded1d95181b943.tar.gz rsplayer-b5872054f641bb417bd1ffc6a9ded1d95181b943.zip | |
no need to ship completions anymore!
| -rw-r--r-- | completions/rsp.bash | 867 | ||||
| -rw-r--r-- | completions/rsp.fish | 100 | ||||
| -rw-r--r-- | completions/rsp.zsh | 632 | ||||
| -rwxr-xr-x | install.sh | 9 | ||||
| -rw-r--r-- | src/cli.rs | 18 |
5 files changed, 20 insertions, 1606 deletions
diff --git a/completions/rsp.bash b/completions/rsp.bash deleted file mode 100644 index f5c87dc..0000000 --- a/completions/rsp.bash +++ /dev/null | |||
| @@ -1,867 +0,0 @@ | |||
| 1 | _rsp() { | ||
| 2 | local i cur prev opts cmd | ||
| 3 | COMPREPLY=() | ||
| 4 | if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then | ||
| 5 | cur="$2" | ||
| 6 | else | ||
| 7 | cur="${COMP_WORDS[COMP_CWORD]}" | ||
| 8 | fi | ||
| 9 | prev="$3" | ||
| 10 | cmd="" | ||
| 11 | opts="" | ||
| 12 | |||
| 13 | for i in "${COMP_WORDS[@]:0:COMP_CWORD}" | ||
| 14 | do | ||
| 15 | case "${cmd},${i}" in | ||
| 16 | ",$1") | ||
| 17 | cmd="rsp" | ||
| 18 | ;; | ||
| 19 | rsp,help) | ||
| 20 | cmd="rsp__subcmd__help" | ||
| 21 | ;; | ||
| 22 | rsp,next) | ||
| 23 | cmd="rsp__subcmd__next" | ||
| 24 | ;; | ||
| 25 | rsp,pause) | ||
| 26 | cmd="rsp__subcmd__pause" | ||
| 27 | ;; | ||
| 28 | rsp,play) | ||
| 29 | cmd="rsp__subcmd__play" | ||
| 30 | ;; | ||
| 31 | rsp,previous) | ||
| 32 | cmd="rsp__subcmd__previous" | ||
| 33 | ;; | ||
| 34 | rsp,queue) | ||
| 35 | cmd="rsp__subcmd__queue" | ||
| 36 | ;; | ||
| 37 | rsp,restart) | ||
| 38 | cmd="rsp__subcmd__restart" | ||
| 39 | ;; | ||
| 40 | rsp,resume) | ||
| 41 | cmd="rsp__subcmd__resume" | ||
| 42 | ;; | ||
| 43 | rsp,scan) | ||
| 44 | cmd="rsp__subcmd__scan" | ||
| 45 | ;; | ||
| 46 | rsp,settings) | ||
| 47 | cmd="rsp__subcmd__settings" | ||
| 48 | ;; | ||
| 49 | rsp,shuffle) | ||
| 50 | cmd="rsp__subcmd__shuffle" | ||
| 51 | ;; | ||
| 52 | rsp,start-daemon) | ||
| 53 | cmd="rsp__subcmd__start__subcmd__daemon" | ||
| 54 | ;; | ||
| 55 | rsp,status) | ||
| 56 | cmd="rsp__subcmd__status" | ||
| 57 | ;; | ||
| 58 | rsp,stop) | ||
| 59 | cmd="rsp__subcmd__stop" | ||
| 60 | ;; | ||
| 61 | rsp,stop-daemon) | ||
| 62 | cmd="rsp__subcmd__stop__subcmd__daemon" | ||
| 63 | ;; | ||
| 64 | rsp,toggle) | ||
| 65 | cmd="rsp__subcmd__toggle" | ||
| 66 | ;; | ||
| 67 | rsp,volume) | ||
| 68 | cmd="rsp__subcmd__volume" | ||
| 69 | ;; | ||
| 70 | rsp__subcmd__help,help) | ||
| 71 | cmd="rsp__subcmd__help__subcmd__help" | ||
| 72 | ;; | ||
| 73 | rsp__subcmd__help,next) | ||
| 74 | cmd="rsp__subcmd__help__subcmd__next" | ||
| 75 | ;; | ||
| 76 | rsp__subcmd__help,pause) | ||
| 77 | cmd="rsp__subcmd__help__subcmd__pause" | ||
| 78 | ;; | ||
| 79 | rsp__subcmd__help,play) | ||
| 80 | cmd="rsp__subcmd__help__subcmd__play" | ||
| 81 | ;; | ||
| 82 | rsp__subcmd__help,previous) | ||
| 83 | cmd="rsp__subcmd__help__subcmd__previous" | ||
| 84 | ;; | ||
| 85 | rsp__subcmd__help,queue) | ||
| 86 | cmd="rsp__subcmd__help__subcmd__queue" | ||
| 87 | ;; | ||
| 88 | rsp__subcmd__help,restart) | ||
| 89 | cmd="rsp__subcmd__help__subcmd__restart" | ||
| 90 | ;; | ||
| 91 | rsp__subcmd__help,resume) | ||
| 92 | cmd="rsp__subcmd__help__subcmd__resume" | ||
| 93 | ;; | ||
| 94 | rsp__subcmd__help,scan) | ||
| 95 | cmd="rsp__subcmd__help__subcmd__scan" | ||
| 96 | ;; | ||
| 97 | rsp__subcmd__help,settings) | ||
| 98 | cmd="rsp__subcmd__help__subcmd__settings" | ||
| 99 | ;; | ||
| 100 | rsp__subcmd__help,shuffle) | ||
| 101 | cmd="rsp__subcmd__help__subcmd__shuffle" | ||
| 102 | ;; | ||
| 103 | rsp__subcmd__help,start-daemon) | ||
| 104 | cmd="rsp__subcmd__help__subcmd__start__subcmd__daemon" | ||
| 105 | ;; | ||
| 106 | rsp__subcmd__help,status) | ||
| 107 | cmd="rsp__subcmd__help__subcmd__status" | ||
| 108 | ;; | ||
| 109 | rsp__subcmd__help,stop) | ||
| 110 | cmd="rsp__subcmd__help__subcmd__stop" | ||
| 111 | ;; | ||
| 112 | rsp__subcmd__help,stop-daemon) | ||
| 113 | cmd="rsp__subcmd__help__subcmd__stop__subcmd__daemon" | ||
| 114 | ;; | ||
| 115 | rsp__subcmd__help,toggle) | ||
| 116 | cmd="rsp__subcmd__help__subcmd__toggle" | ||
| 117 | ;; | ||
| 118 | rsp__subcmd__help,volume) | ||
| 119 | cmd="rsp__subcmd__help__subcmd__volume" | ||
| 120 | ;; | ||
| 121 | rsp__subcmd__help__subcmd__settings,get) | ||
| 122 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__get" | ||
| 123 | ;; | ||
| 124 | rsp__subcmd__help__subcmd__settings,list) | ||
| 125 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__list" | ||
| 126 | ;; | ||
| 127 | rsp__subcmd__help__subcmd__settings,set) | ||
| 128 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__set" | ||
| 129 | ;; | ||
| 130 | rsp__subcmd__help__subcmd__settings,unset) | ||
| 131 | cmd="rsp__subcmd__help__subcmd__settings__subcmd__unset" | ||
| 132 | ;; | ||
| 133 | rsp__subcmd__settings,get) | ||
| 134 | cmd="rsp__subcmd__settings__subcmd__get" | ||
| 135 | ;; | ||
| 136 | rsp__subcmd__settings,help) | ||
| 137 | cmd="rsp__subcmd__settings__subcmd__help" | ||
| 138 | ;; | ||
| 139 | rsp__subcmd__settings,list) | ||
| 140 | cmd="rsp__subcmd__settings__subcmd__list" | ||
| 141 | ;; | ||
| 142 | rsp__subcmd__settings,set) | ||
| 143 | cmd="rsp__subcmd__settings__subcmd__set" | ||
| 144 | ;; | ||
| 145 | rsp__subcmd__settings,unset) | ||
| 146 | cmd="rsp__subcmd__settings__subcmd__unset" | ||
| 147 | ;; | ||
| 148 | rsp__subcmd__settings__subcmd__help,get) | ||
| 149 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__get" | ||
| 150 | ;; | ||
| 151 | rsp__subcmd__settings__subcmd__help,help) | ||
| 152 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__help" | ||
| 153 | ;; | ||
| 154 | rsp__subcmd__settings__subcmd__help,list) | ||
| 155 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__list" | ||
| 156 | ;; | ||
| 157 | rsp__subcmd__settings__subcmd__help,set) | ||
| 158 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__set" | ||
| 159 | ;; | ||
| 160 | rsp__subcmd__settings__subcmd__help,unset) | ||
| 161 | cmd="rsp__subcmd__settings__subcmd__help__subcmd__unset" | ||
| 162 | ;; | ||
| 163 | *) | ||
| 164 | ;; | ||
| 165 | esac | ||
| 166 | done | ||
| 167 | |||
| 168 | case "${cmd}" in | ||
| 169 | rsp) | ||
| 170 | opts="-h --help start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" | ||
| 171 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then | ||
| 172 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 173 | return 0 | ||
| 174 | fi | ||
| 175 | case "${prev}" in | ||
| 176 | *) | ||
| 177 | COMPREPLY=() | ||
| 178 | ;; | ||
| 179 | esac | ||
| 180 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 181 | return 0 | ||
| 182 | ;; | ||
| 183 | rsp__subcmd__help) | ||
| 184 | opts="start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" | ||
| 185 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 186 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 187 | return 0 | ||
| 188 | fi | ||
| 189 | case "${prev}" in | ||
| 190 | *) | ||
| 191 | COMPREPLY=() | ||
| 192 | ;; | ||
| 193 | esac | ||
| 194 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 195 | return 0 | ||
| 196 | ;; | ||
| 197 | rsp__subcmd__help__subcmd__help) | ||
| 198 | opts="" | ||
| 199 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 200 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 201 | return 0 | ||
| 202 | fi | ||
| 203 | case "${prev}" in | ||
| 204 | *) | ||
| 205 | COMPREPLY=() | ||
| 206 | ;; | ||
| 207 | esac | ||
| 208 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 209 | return 0 | ||
| 210 | ;; | ||
| 211 | rsp__subcmd__help__subcmd__next) | ||
| 212 | opts="" | ||
| 213 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 214 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 215 | return 0 | ||
| 216 | fi | ||
| 217 | case "${prev}" in | ||
| 218 | *) | ||
| 219 | COMPREPLY=() | ||
| 220 | ;; | ||
| 221 | esac | ||
| 222 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 223 | return 0 | ||
| 224 | ;; | ||
| 225 | rsp__subcmd__help__subcmd__pause) | ||
| 226 | opts="" | ||
| 227 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 228 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 229 | return 0 | ||
| 230 | fi | ||
| 231 | case "${prev}" in | ||
| 232 | *) | ||
| 233 | COMPREPLY=() | ||
| 234 | ;; | ||
| 235 | esac | ||
| 236 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 237 | return 0 | ||
| 238 | ;; | ||
| 239 | rsp__subcmd__help__subcmd__play) | ||
| 240 | opts="" | ||
| 241 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 242 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 243 | return 0 | ||
| 244 | fi | ||
| 245 | case "${prev}" in | ||
| 246 | *) | ||
| 247 | COMPREPLY=() | ||
| 248 | ;; | ||
| 249 | esac | ||
| 250 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 251 | return 0 | ||
| 252 | ;; | ||
| 253 | rsp__subcmd__help__subcmd__previous) | ||
| 254 | opts="" | ||
| 255 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 256 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 257 | return 0 | ||
| 258 | fi | ||
| 259 | case "${prev}" in | ||
| 260 | *) | ||
| 261 | COMPREPLY=() | ||
| 262 | ;; | ||
| 263 | esac | ||
| 264 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 265 | return 0 | ||
| 266 | ;; | ||
| 267 | rsp__subcmd__help__subcmd__queue) | ||
| 268 | opts="" | ||
| 269 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 270 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 271 | return 0 | ||
| 272 | fi | ||
| 273 | case "${prev}" in | ||
| 274 | *) | ||
| 275 | COMPREPLY=() | ||
| 276 | ;; | ||
| 277 | esac | ||
| 278 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 279 | return 0 | ||
| 280 | ;; | ||
| 281 | rsp__subcmd__help__subcmd__restart) | ||
| 282 | opts="" | ||
| 283 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 284 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 285 | return 0 | ||
| 286 | fi | ||
| 287 | case "${prev}" in | ||
| 288 | *) | ||
| 289 | COMPREPLY=() | ||
| 290 | ;; | ||
| 291 | esac | ||
| 292 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 293 | return 0 | ||
| 294 | ;; | ||
| 295 | rsp__subcmd__help__subcmd__resume) | ||
| 296 | opts="" | ||
| 297 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 298 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 299 | return 0 | ||
| 300 | fi | ||
| 301 | case "${prev}" in | ||
| 302 | *) | ||
| 303 | COMPREPLY=() | ||
| 304 | ;; | ||
| 305 | esac | ||
| 306 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 307 | return 0 | ||
| 308 | ;; | ||
| 309 | rsp__subcmd__help__subcmd__scan) | ||
| 310 | opts="" | ||
| 311 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 312 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 313 | return 0 | ||
| 314 | fi | ||
| 315 | case "${prev}" in | ||
| 316 | *) | ||
| 317 | COMPREPLY=() | ||
| 318 | ;; | ||
| 319 | esac | ||
| 320 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 321 | return 0 | ||
| 322 | ;; | ||
| 323 | rsp__subcmd__help__subcmd__settings) | ||
| 324 | opts="get set list unset" | ||
| 325 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 326 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 327 | return 0 | ||
| 328 | fi | ||
| 329 | case "${prev}" in | ||
| 330 | *) | ||
| 331 | COMPREPLY=() | ||
| 332 | ;; | ||
| 333 | esac | ||
| 334 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 335 | return 0 | ||
| 336 | ;; | ||
| 337 | rsp__subcmd__help__subcmd__settings__subcmd__get) | ||
| 338 | opts="" | ||
| 339 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 340 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 341 | return 0 | ||
| 342 | fi | ||
| 343 | case "${prev}" in | ||
| 344 | *) | ||
| 345 | COMPREPLY=() | ||
| 346 | ;; | ||
| 347 | esac | ||
| 348 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 349 | return 0 | ||
| 350 | ;; | ||
| 351 | rsp__subcmd__help__subcmd__settings__subcmd__list) | ||
| 352 | opts="" | ||
| 353 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 354 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 355 | return 0 | ||
| 356 | fi | ||
| 357 | case "${prev}" in | ||
| 358 | *) | ||
| 359 | COMPREPLY=() | ||
| 360 | ;; | ||
| 361 | esac | ||
| 362 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 363 | return 0 | ||
| 364 | ;; | ||
| 365 | rsp__subcmd__help__subcmd__settings__subcmd__set) | ||
| 366 | opts="" | ||
| 367 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 368 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 369 | return 0 | ||
| 370 | fi | ||
| 371 | case "${prev}" in | ||
| 372 | *) | ||
| 373 | COMPREPLY=() | ||
| 374 | ;; | ||
| 375 | esac | ||
| 376 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 377 | return 0 | ||
| 378 | ;; | ||
| 379 | rsp__subcmd__help__subcmd__settings__subcmd__unset) | ||
| 380 | opts="" | ||
| 381 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 382 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 383 | return 0 | ||
| 384 | fi | ||
| 385 | case "${prev}" in | ||
| 386 | *) | ||
| 387 | COMPREPLY=() | ||
| 388 | ;; | ||
| 389 | esac | ||
| 390 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 391 | return 0 | ||
| 392 | ;; | ||
| 393 | rsp__subcmd__help__subcmd__shuffle) | ||
| 394 | opts="" | ||
| 395 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 396 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 397 | return 0 | ||
| 398 | fi | ||
| 399 | case "${prev}" in | ||
| 400 | *) | ||
| 401 | COMPREPLY=() | ||
| 402 | ;; | ||
| 403 | esac | ||
| 404 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 405 | return 0 | ||
| 406 | ;; | ||
| 407 | rsp__subcmd__help__subcmd__start__subcmd__daemon) | ||
| 408 | opts="" | ||
| 409 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 410 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 411 | return 0 | ||
| 412 | fi | ||
| 413 | case "${prev}" in | ||
| 414 | *) | ||
| 415 | COMPREPLY=() | ||
| 416 | ;; | ||
| 417 | esac | ||
| 418 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 419 | return 0 | ||
| 420 | ;; | ||
| 421 | rsp__subcmd__help__subcmd__status) | ||
| 422 | opts="" | ||
| 423 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 424 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 425 | return 0 | ||
| 426 | fi | ||
| 427 | case "${prev}" in | ||
| 428 | *) | ||
| 429 | COMPREPLY=() | ||
| 430 | ;; | ||
| 431 | esac | ||
| 432 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 433 | return 0 | ||
| 434 | ;; | ||
| 435 | rsp__subcmd__help__subcmd__stop) | ||
| 436 | opts="" | ||
| 437 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 438 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 439 | return 0 | ||
| 440 | fi | ||
| 441 | case "${prev}" in | ||
| 442 | *) | ||
| 443 | COMPREPLY=() | ||
| 444 | ;; | ||
| 445 | esac | ||
| 446 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 447 | return 0 | ||
| 448 | ;; | ||
| 449 | rsp__subcmd__help__subcmd__stop__subcmd__daemon) | ||
| 450 | opts="" | ||
| 451 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 452 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 453 | return 0 | ||
| 454 | fi | ||
| 455 | case "${prev}" in | ||
| 456 | *) | ||
| 457 | COMPREPLY=() | ||
| 458 | ;; | ||
| 459 | esac | ||
| 460 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 461 | return 0 | ||
| 462 | ;; | ||
| 463 | rsp__subcmd__help__subcmd__toggle) | ||
| 464 | opts="" | ||
| 465 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 466 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 467 | return 0 | ||
| 468 | fi | ||
| 469 | case "${prev}" in | ||
| 470 | *) | ||
| 471 | COMPREPLY=() | ||
| 472 | ;; | ||
| 473 | esac | ||
| 474 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 475 | return 0 | ||
| 476 | ;; | ||
| 477 | rsp__subcmd__help__subcmd__volume) | ||
| 478 | opts="" | ||
| 479 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 480 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 481 | return 0 | ||
| 482 | fi | ||
| 483 | case "${prev}" in | ||
| 484 | *) | ||
| 485 | COMPREPLY=() | ||
| 486 | ;; | ||
| 487 | esac | ||
| 488 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 489 | return 0 | ||
| 490 | ;; | ||
| 491 | rsp__subcmd__next) | ||
| 492 | opts="-h --help" | ||
| 493 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 494 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 495 | return 0 | ||
| 496 | fi | ||
| 497 | case "${prev}" in | ||
| 498 | *) | ||
| 499 | COMPREPLY=() | ||
| 500 | ;; | ||
| 501 | esac | ||
| 502 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 503 | return 0 | ||
| 504 | ;; | ||
| 505 | rsp__subcmd__pause) | ||
| 506 | opts="-h --help" | ||
| 507 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 508 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 509 | return 0 | ||
| 510 | fi | ||
| 511 | case "${prev}" in | ||
| 512 | *) | ||
| 513 | COMPREPLY=() | ||
| 514 | ;; | ||
| 515 | esac | ||
| 516 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 517 | return 0 | ||
| 518 | ;; | ||
| 519 | rsp__subcmd__play) | ||
| 520 | opts="-i -n -h --now --next --help [QUERY]" | ||
| 521 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 522 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 523 | return 0 | ||
| 524 | fi | ||
| 525 | case "${prev}" in | ||
| 526 | *) | ||
| 527 | COMPREPLY=() | ||
| 528 | ;; | ||
| 529 | esac | ||
| 530 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 531 | return 0 | ||
| 532 | ;; | ||
| 533 | rsp__subcmd__previous) | ||
| 534 | opts="-h --help" | ||
| 535 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 536 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 537 | return 0 | ||
| 538 | fi | ||
| 539 | case "${prev}" in | ||
| 540 | *) | ||
| 541 | COMPREPLY=() | ||
| 542 | ;; | ||
| 543 | esac | ||
| 544 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 545 | return 0 | ||
| 546 | ;; | ||
| 547 | rsp__subcmd__queue) | ||
| 548 | opts="-h --help [POSITION] [QUERY]" | ||
| 549 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 550 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 551 | return 0 | ||
| 552 | fi | ||
| 553 | case "${prev}" in | ||
| 554 | *) | ||
| 555 | COMPREPLY=() | ||
| 556 | ;; | ||
| 557 | esac | ||
| 558 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 559 | return 0 | ||
| 560 | ;; | ||
| 561 | rsp__subcmd__restart) | ||
| 562 | opts="-h --help" | ||
| 563 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 564 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 565 | return 0 | ||
| 566 | fi | ||
| 567 | case "${prev}" in | ||
| 568 | *) | ||
| 569 | COMPREPLY=() | ||
| 570 | ;; | ||
| 571 | esac | ||
| 572 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 573 | return 0 | ||
| 574 | ;; | ||
| 575 | rsp__subcmd__resume) | ||
| 576 | opts="-h --help" | ||
| 577 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 578 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 579 | return 0 | ||
| 580 | fi | ||
| 581 | case "${prev}" in | ||
| 582 | *) | ||
| 583 | COMPREPLY=() | ||
| 584 | ;; | ||
| 585 | esac | ||
| 586 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 587 | return 0 | ||
| 588 | ;; | ||
| 589 | rsp__subcmd__scan) | ||
| 590 | opts="-h --force --paths --help" | ||
| 591 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 592 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 593 | return 0 | ||
| 594 | fi | ||
| 595 | case "${prev}" in | ||
| 596 | --paths) | ||
| 597 | COMPREPLY=($(compgen -f "${cur}")) | ||
| 598 | return 0 | ||
| 599 | ;; | ||
| 600 | *) | ||
| 601 | COMPREPLY=() | ||
| 602 | ;; | ||
| 603 | esac | ||
| 604 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 605 | return 0 | ||
| 606 | ;; | ||
| 607 | rsp__subcmd__settings) | ||
| 608 | opts="-h --help get set list unset help" | ||
| 609 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 610 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 611 | return 0 | ||
| 612 | fi | ||
| 613 | case "${prev}" in | ||
| 614 | *) | ||
| 615 | COMPREPLY=() | ||
| 616 | ;; | ||
| 617 | esac | ||
| 618 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 619 | return 0 | ||
| 620 | ;; | ||
| 621 | rsp__subcmd__settings__subcmd__get) | ||
| 622 | opts="-h --help <KEY>" | ||
| 623 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 624 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 625 | return 0 | ||
| 626 | fi | ||
| 627 | case "${prev}" in | ||
| 628 | *) | ||
| 629 | COMPREPLY=() | ||
| 630 | ;; | ||
| 631 | esac | ||
| 632 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 633 | return 0 | ||
| 634 | ;; | ||
| 635 | rsp__subcmd__settings__subcmd__help) | ||
| 636 | opts="get set list unset help" | ||
| 637 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 638 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 639 | return 0 | ||
| 640 | fi | ||
| 641 | case "${prev}" in | ||
| 642 | *) | ||
| 643 | COMPREPLY=() | ||
| 644 | ;; | ||
| 645 | esac | ||
| 646 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 647 | return 0 | ||
| 648 | ;; | ||
| 649 | rsp__subcmd__settings__subcmd__help__subcmd__get) | ||
| 650 | opts="" | ||
| 651 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 652 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 653 | return 0 | ||
| 654 | fi | ||
| 655 | case "${prev}" in | ||
| 656 | *) | ||
| 657 | COMPREPLY=() | ||
| 658 | ;; | ||
| 659 | esac | ||
| 660 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 661 | return 0 | ||
| 662 | ;; | ||
| 663 | rsp__subcmd__settings__subcmd__help__subcmd__help) | ||
| 664 | opts="" | ||
| 665 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 666 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 667 | return 0 | ||
| 668 | fi | ||
| 669 | case "${prev}" in | ||
| 670 | *) | ||
| 671 | COMPREPLY=() | ||
| 672 | ;; | ||
| 673 | esac | ||
| 674 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 675 | return 0 | ||
| 676 | ;; | ||
| 677 | rsp__subcmd__settings__subcmd__help__subcmd__list) | ||
| 678 | opts="" | ||
| 679 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 680 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 681 | return 0 | ||
| 682 | fi | ||
| 683 | case "${prev}" in | ||
| 684 | *) | ||
| 685 | COMPREPLY=() | ||
| 686 | ;; | ||
| 687 | esac | ||
| 688 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 689 | return 0 | ||
| 690 | ;; | ||
| 691 | rsp__subcmd__settings__subcmd__help__subcmd__set) | ||
| 692 | opts="" | ||
| 693 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 694 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 695 | return 0 | ||
| 696 | fi | ||
| 697 | case "${prev}" in | ||
| 698 | *) | ||
| 699 | COMPREPLY=() | ||
| 700 | ;; | ||
| 701 | esac | ||
| 702 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 703 | return 0 | ||
| 704 | ;; | ||
| 705 | rsp__subcmd__settings__subcmd__help__subcmd__unset) | ||
| 706 | opts="" | ||
| 707 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then | ||
| 708 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 709 | return 0 | ||
| 710 | fi | ||
| 711 | case "${prev}" in | ||
| 712 | *) | ||
| 713 | COMPREPLY=() | ||
| 714 | ;; | ||
| 715 | esac | ||
| 716 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 717 | return 0 | ||
| 718 | ;; | ||
| 719 | rsp__subcmd__settings__subcmd__list) | ||
| 720 | opts="-h --help" | ||
| 721 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 722 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 723 | return 0 | ||
| 724 | fi | ||
| 725 | case "${prev}" in | ||
| 726 | *) | ||
| 727 | COMPREPLY=() | ||
| 728 | ;; | ||
| 729 | esac | ||
| 730 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 731 | return 0 | ||
| 732 | ;; | ||
| 733 | rsp__subcmd__settings__subcmd__set) | ||
| 734 | opts="-h --help <KEY> <VALUE>" | ||
| 735 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 736 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 737 | return 0 | ||
| 738 | fi | ||
| 739 | case "${prev}" in | ||
| 740 | *) | ||
| 741 | COMPREPLY=() | ||
| 742 | ;; | ||
| 743 | esac | ||
| 744 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 745 | return 0 | ||
| 746 | ;; | ||
| 747 | rsp__subcmd__settings__subcmd__unset) | ||
| 748 | opts="-h --help <KEY>" | ||
| 749 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then | ||
| 750 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 751 | return 0 | ||
| 752 | fi | ||
| 753 | case "${prev}" in | ||
| 754 | *) | ||
| 755 | COMPREPLY=() | ||
| 756 | ;; | ||
| 757 | esac | ||
| 758 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 759 | return 0 | ||
| 760 | ;; | ||
| 761 | rsp__subcmd__shuffle) | ||
| 762 | opts="-h --help [MODE]" | ||
| 763 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 764 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 765 | return 0 | ||
| 766 | fi | ||
| 767 | case "${prev}" in | ||
| 768 | *) | ||
| 769 | COMPREPLY=( $(compgen -W "on off all none album albums" -- "${cur}") ) | ||
| 770 | return 0 | ||
| 771 | ;; | ||
| 772 | esac | ||
| 773 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 774 | return 0 | ||
| 775 | ;; | ||
| 776 | rsp__subcmd__start__subcmd__daemon) | ||
| 777 | opts="-h --help" | ||
| 778 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 779 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 780 | return 0 | ||
| 781 | fi | ||
| 782 | case "${prev}" in | ||
| 783 | *) | ||
| 784 | COMPREPLY=() | ||
| 785 | ;; | ||
| 786 | esac | ||
| 787 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 788 | return 0 | ||
| 789 | ;; | ||
| 790 | rsp__subcmd__status) | ||
| 791 | opts="-h --help" | ||
| 792 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 793 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 794 | return 0 | ||
| 795 | fi | ||
| 796 | case "${prev}" in | ||
| 797 | *) | ||
| 798 | COMPREPLY=() | ||
| 799 | ;; | ||
| 800 | esac | ||
| 801 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 802 | return 0 | ||
| 803 | ;; | ||
| 804 | rsp__subcmd__stop) | ||
| 805 | opts="-h --help" | ||
| 806 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 807 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 808 | return 0 | ||
| 809 | fi | ||
| 810 | case "${prev}" in | ||
| 811 | *) | ||
| 812 | COMPREPLY=() | ||
| 813 | ;; | ||
| 814 | esac | ||
| 815 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 816 | return 0 | ||
| 817 | ;; | ||
| 818 | rsp__subcmd__stop__subcmd__daemon) | ||
| 819 | opts="-h --help" | ||
| 820 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 821 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 822 | return 0 | ||
| 823 | fi | ||
| 824 | case "${prev}" in | ||
| 825 | *) | ||
| 826 | COMPREPLY=() | ||
| 827 | ;; | ||
| 828 | esac | ||
| 829 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 830 | return 0 | ||
| 831 | ;; | ||
| 832 | rsp__subcmd__toggle) | ||
| 833 | opts="-h --help" | ||
| 834 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 835 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 836 | return 0 | ||
| 837 | fi | ||
| 838 | case "${prev}" in | ||
| 839 | *) | ||
| 840 | COMPREPLY=() | ||
| 841 | ;; | ||
| 842 | esac | ||
| 843 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 844 | return 0 | ||
| 845 | ;; | ||
| 846 | rsp__subcmd__volume) | ||
| 847 | opts="-h --help [LEVEL]" | ||
| 848 | if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then | ||
| 849 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 850 | return 0 | ||
| 851 | fi | ||
| 852 | case "${prev}" in | ||
| 853 | *) | ||
| 854 | COMPREPLY=() | ||
| 855 | ;; | ||
| 856 | esac | ||
| 857 | COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) | ||
| 858 | return 0 | ||
| 859 | ;; | ||
| 860 | esac | ||
| 861 | } | ||
| 862 | |||
| 863 | if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then | ||
| 864 | complete -F _rsp -o nosort -o bashdefault -o default rsp | ||
| 865 | else | ||
| 866 | complete -F _rsp -o bashdefault -o default rsp | ||
| 867 | fi | ||
diff --git a/completions/rsp.fish b/completions/rsp.fish deleted file mode 100644 index 56f3766..0000000 --- a/completions/rsp.fish +++ /dev/null | |||
| @@ -1,100 +0,0 @@ | |||
| 1 | # Print an optspec for argparse to handle cmd's options that are independent of any subcommand. | ||
| 2 | function __fish_rsp_global_optspecs | ||
| 3 | string join \n h/help | ||
| 4 | end | ||
| 5 | |||
| 6 | function __fish_rsp_needs_command | ||
| 7 | # Figure out if the current invocation already has a command. | ||
| 8 | set -l cmd (commandline -opc) | ||
| 9 | set -e cmd[1] | ||
| 10 | argparse -s (__fish_rsp_global_optspecs) -- $cmd 2>/dev/null | ||
| 11 | or return | ||
| 12 | if set -q argv[1] | ||
| 13 | # Also print the command, so this can be used to figure out what it is. | ||
| 14 | echo $argv[1] | ||
| 15 | return 1 | ||
| 16 | end | ||
| 17 | return 0 | ||
| 18 | end | ||
| 19 | |||
| 20 | function __fish_rsp_using_subcommand | ||
| 21 | set -l cmd (__fish_rsp_needs_command) | ||
| 22 | test -z "$cmd" | ||
| 23 | and return 1 | ||
| 24 | contains -- $cmd[1] $argv | ||
| 25 | end | ||
| 26 | |||
| 27 | complete -c rsp -n "__fish_rsp_needs_command" -s h -l help -d 'Print help' | ||
| 28 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "start-daemon" -d 'Start the daemon' | ||
| 29 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "stop-daemon" -d 'Stop the daemon' | ||
| 30 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "restart" -d 'Restart the daemon (kill existing and start new)' | ||
| 31 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "play" -d 'Play a track, album, or artist' | ||
| 32 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "pause" -d 'Pause playback' | ||
| 33 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "resume" -d 'Resume playback' | ||
| 34 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "toggle" -d 'Toggle play/pause' | ||
| 35 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "stop" -d 'Stop playback' | ||
| 36 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "next" -d 'Skip to next track' | ||
| 37 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "previous" -d 'Skip to previous track' | ||
| 38 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "volume" -d 'Set volume (0-100)' | ||
| 39 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "shuffle" -d 'Shuffle mode' | ||
| 40 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "queue" -d 'Queue management' | ||
| 41 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "status" -d 'Show player status' | ||
| 42 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "scan" -d 'Scan music paths to populate database' | ||
| 43 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "settings" -d 'Settings management' | ||
| 44 | complete -c rsp -n "__fish_rsp_needs_command" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' | ||
| 45 | complete -c rsp -n "__fish_rsp_using_subcommand start-daemon" -s h -l help -d 'Print help' | ||
| 46 | complete -c rsp -n "__fish_rsp_using_subcommand stop-daemon" -s h -l help -d 'Print help' | ||
| 47 | complete -c rsp -n "__fish_rsp_using_subcommand restart" -s h -l help -d 'Print help' | ||
| 48 | complete -c rsp -n "__fish_rsp_using_subcommand play" -s i -l now -d 'Add after current track and skip to it' | ||
| 49 | complete -c rsp -n "__fish_rsp_using_subcommand play" -s n -l next -d 'Add to queue after current track (don\'t skip)' | ||
| 50 | complete -c rsp -n "__fish_rsp_using_subcommand play" -s h -l help -d 'Print help' | ||
| 51 | complete -c rsp -n "__fish_rsp_using_subcommand pause" -s h -l help -d 'Print help' | ||
| 52 | complete -c rsp -n "__fish_rsp_using_subcommand resume" -s h -l help -d 'Print help' | ||
| 53 | complete -c rsp -n "__fish_rsp_using_subcommand toggle" -s h -l help -d 'Print help' | ||
| 54 | complete -c rsp -n "__fish_rsp_using_subcommand stop" -s h -l help -d 'Print help' | ||
| 55 | complete -c rsp -n "__fish_rsp_using_subcommand next" -s h -l help -d 'Print help' | ||
| 56 | complete -c rsp -n "__fish_rsp_using_subcommand previous" -s h -l help -d 'Print help' | ||
| 57 | complete -c rsp -n "__fish_rsp_using_subcommand volume" -s h -l help -d 'Print help' | ||
| 58 | complete -c rsp -n "__fish_rsp_using_subcommand shuffle" -s h -l help -d 'Print help' | ||
| 59 | complete -c rsp -n "__fish_rsp_using_subcommand shuffle" -f -a "on off all none album albums" -d 'Shuffle mode' | ||
| 60 | complete -c rsp -n "__fish_rsp_using_subcommand queue" -s h -l help -d 'Print help' | ||
| 61 | complete -c rsp -n "__fish_rsp_using_subcommand status" -s h -l help -d 'Print help' | ||
| 62 | complete -c rsp -n "__fish_rsp_using_subcommand scan" -l paths -r -F | ||
| 63 | complete -c rsp -n "__fish_rsp_using_subcommand scan" -l force | ||
| 64 | complete -c rsp -n "__fish_rsp_using_subcommand scan" -s h -l help -d 'Print help' | ||
| 65 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and not __fish_seen_subcommand_from get set list unset help" -s h -l help -d 'Print help' | ||
| 66 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and not __fish_seen_subcommand_from get set list unset help" -f -a "get" -d 'Get a setting value' | ||
| 67 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and not __fish_seen_subcommand_from get set list unset help" -f -a "set" -d 'Set a setting value' | ||
| 68 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and not __fish_seen_subcommand_from get set list unset help" -f -a "list" -d 'List all settings' | ||
| 69 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and not __fish_seen_subcommand_from get set list unset help" -f -a "unset" -d 'Unset a setting' | ||
| 70 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and not __fish_seen_subcommand_from get set list unset help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' | ||
| 71 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from get" -s h -l help -d 'Print help' | ||
| 72 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from set" -s h -l help -d 'Print help' | ||
| 73 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from list" -s h -l help -d 'Print help' | ||
| 74 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from unset" -s h -l help -d 'Print help' | ||
| 75 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from help" -f -a "get" -d 'Get a setting value' | ||
| 76 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from help" -f -a "set" -d 'Set a setting value' | ||
| 77 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from help" -f -a "list" -d 'List all settings' | ||
| 78 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from help" -f -a "unset" -d 'Unset a setting' | ||
| 79 | complete -c rsp -n "__fish_rsp_using_subcommand settings; and __fish_seen_subcommand_from help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' | ||
| 80 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "start-daemon" -d 'Start the daemon' | ||
| 81 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "stop-daemon" -d 'Stop the daemon' | ||
| 82 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "restart" -d 'Restart the daemon (kill existing and start new)' | ||
| 83 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "play" -d 'Play a track, album, or artist' | ||
| 84 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "pause" -d 'Pause playback' | ||
| 85 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "resume" -d 'Resume playback' | ||
| 86 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "toggle" -d 'Toggle play/pause' | ||
| 87 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "stop" -d 'Stop playback' | ||
| 88 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "next" -d 'Skip to next track' | ||
| 89 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "previous" -d 'Skip to previous track' | ||
| 90 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "volume" -d 'Set volume (0-100)' | ||
| 91 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "shuffle" -d 'Shuffle mode' | ||
| 92 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "queue" -d 'Queue management' | ||
| 93 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "status" -d 'Show player status' | ||
| 94 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "scan" -d 'Scan music paths to populate database' | ||
| 95 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "settings" -d 'Settings management' | ||
| 96 | complete -c rsp -n "__fish_rsp_using_subcommand help; and not __fish_seen_subcommand_from start-daemon stop-daemon restart play pause resume toggle stop next previous volume shuffle queue status scan settings help" -f -a "help" -d 'Print this message or the help of the given subcommand(s)' | ||
| 97 | complete -c rsp -n "__fish_rsp_using_subcommand help; and __fish_seen_subcommand_from settings" -f -a "get" -d 'Get a setting value' | ||
| 98 | complete -c rsp -n "__fish_rsp_using_subcommand help; and __fish_seen_subcommand_from settings" -f -a "set" -d 'Set a setting value' | ||
| 99 | complete -c rsp -n "__fish_rsp_using_subcommand help; and __fish_seen_subcommand_from settings" -f -a "list" -d 'List all settings' | ||
| 100 | complete -c rsp -n "__fish_rsp_using_subcommand help; and __fish_seen_subcommand_from settings" -f -a "unset" -d 'Unset a setting' | ||
diff --git a/completions/rsp.zsh b/completions/rsp.zsh deleted file mode 100644 index 87fbfcd..0000000 --- a/completions/rsp.zsh +++ /dev/null | |||
| @@ -1,632 +0,0 @@ | |||
| 1 | #compdef rsp | ||
| 2 | |||
| 3 | autoload -U is-at-least | ||
| 4 | |||
| 5 | _rsp() { | ||
| 6 | typeset -A opt_args | ||
| 7 | typeset -a _arguments_options | ||
| 8 | local ret=1 | ||
| 9 | |||
| 10 | if is-at-least 5.2; then | ||
| 11 | _arguments_options=(-s -S -C) | ||
| 12 | else | ||
| 13 | _arguments_options=(-s -C) | ||
| 14 | fi | ||
| 15 | |||
| 16 | local context curcontext="$curcontext" state line | ||
| 17 | _arguments "${_arguments_options[@]}" : \ | ||
| 18 | '-h[Print help]' \ | ||
| 19 | '--help[Print help]' \ | ||
| 20 | ":: :_rsp_commands" \ | ||
| 21 | "*::: :->rsp" \ | ||
| 22 | && ret=0 | ||
| 23 | case $state in | ||
| 24 | (rsp) | ||
| 25 | words=($line[1] "${words[@]}") | ||
| 26 | (( CURRENT += 1 )) | ||
| 27 | curcontext="${curcontext%:*:*}:rsp-command-$line[1]:" | ||
| 28 | case $line[1] in | ||
| 29 | (start-daemon) | ||
| 30 | _arguments "${_arguments_options[@]}" : \ | ||
| 31 | '-h[Print help]' \ | ||
| 32 | '--help[Print help]' \ | ||
| 33 | && ret=0 | ||
| 34 | ;; | ||
| 35 | (stop-daemon) | ||
| 36 | _arguments "${_arguments_options[@]}" : \ | ||
| 37 | '-h[Print help]' \ | ||
| 38 | '--help[Print help]' \ | ||
| 39 | && ret=0 | ||
| 40 | ;; | ||
| 41 | (restart) | ||
| 42 | _arguments "${_arguments_options[@]}" : \ | ||
| 43 | '-h[Print help]' \ | ||
| 44 | '--help[Print help]' \ | ||
| 45 | && ret=0 | ||
| 46 | ;; | ||
| 47 | (play) | ||
| 48 | _arguments "${_arguments_options[@]}" : \ | ||
| 49 | '-i[Add after current track and skip to it]' \ | ||
| 50 | '--now[Add after current track and skip to it]' \ | ||
| 51 | '-n[Add to queue after current track (don'\''t skip)]' \ | ||
| 52 | '--next[Add to queue after current track (don'\''t skip)]' \ | ||
| 53 | '-h[Print help]' \ | ||
| 54 | '--help[Print help]' \ | ||
| 55 | '::query:_default' \ | ||
| 56 | && ret=0 | ||
| 57 | ;; | ||
| 58 | (pause) | ||
| 59 | _arguments "${_arguments_options[@]}" : \ | ||
| 60 | '-h[Print help]' \ | ||
| 61 | '--help[Print help]' \ | ||
| 62 | && ret=0 | ||
| 63 | ;; | ||
| 64 | (resume) | ||
| 65 | _arguments "${_arguments_options[@]}" : \ | ||
| 66 | '-h[Print help]' \ | ||
| 67 | '--help[Print help]' \ | ||
| 68 | && ret=0 | ||
| 69 | ;; | ||
| 70 | (toggle) | ||
| 71 | _arguments "${_arguments_options[@]}" : \ | ||
| 72 | '-h[Print help]' \ | ||
| 73 | '--help[Print help]' \ | ||
| 74 | && ret=0 | ||
| 75 | ;; | ||
| 76 | (stop) | ||
| 77 | _arguments "${_arguments_options[@]}" : \ | ||
| 78 | '-h[Print help]' \ | ||
| 79 | '--help[Print help]' \ | ||
| 80 | && ret=0 | ||
| 81 | ;; | ||
| 82 | (next) | ||
| 83 | _arguments "${_arguments_options[@]}" : \ | ||
| 84 | '-h[Print help]' \ | ||
| 85 | '--help[Print help]' \ | ||
| 86 | && ret=0 | ||
| 87 | ;; | ||
| 88 | (previous) | ||
| 89 | _arguments "${_arguments_options[@]}" : \ | ||
| 90 | '-h[Print help]' \ | ||
| 91 | '--help[Print help]' \ | ||
| 92 | && ret=0 | ||
| 93 | ;; | ||
| 94 | (volume) | ||
| 95 | _arguments "${_arguments_options[@]}" : \ | ||
| 96 | '-h[Print help]' \ | ||
| 97 | '--help[Print help]' \ | ||
| 98 | '::level:_default' \ | ||
| 99 | && ret=0 | ||
| 100 | ;; | ||
| 101 | (shuffle) | ||
| 102 | _arguments "${_arguments_options[@]}" : \ | ||
| 103 | '-h[Print help]' \ | ||
| 104 | '--help[Print help]' \ | ||
| 105 | '::mode:(on off all none album albums)' \ | ||
| 106 | && ret=0 | ||
| 107 | ;; | ||
| 108 | (queue) | ||
| 109 | _arguments "${_arguments_options[@]}" : \ | ||
| 110 | '-h[Print help]' \ | ||
| 111 | '--help[Print help]' \ | ||
| 112 | '::position:_default' \ | ||
| 113 | '::query:_default' \ | ||
| 114 | && ret=0 | ||
| 115 | ;; | ||
| 116 | (status) | ||
| 117 | _arguments "${_arguments_options[@]}" : \ | ||
| 118 | '-h[Print help]' \ | ||
| 119 | '--help[Print help]' \ | ||
| 120 | && ret=0 | ||
| 121 | ;; | ||
| 122 | (scan) | ||
| 123 | _arguments "${_arguments_options[@]}" : \ | ||
| 124 | '*--paths=[]:PATHS:_files' \ | ||
| 125 | '--force[]' \ | ||
| 126 | '-h[Print help]' \ | ||
| 127 | '--help[Print help]' \ | ||
| 128 | && ret=0 | ||
| 129 | ;; | ||
| 130 | (settings) | ||
| 131 | _arguments "${_arguments_options[@]}" : \ | ||
| 132 | '-h[Print help]' \ | ||
| 133 | '--help[Print help]' \ | ||
| 134 | ":: :_rsp__subcmd__settings_commands" \ | ||
| 135 | "*::: :->settings" \ | ||
| 136 | && ret=0 | ||
| 137 | |||
| 138 | case $state in | ||
| 139 | (settings) | ||
| 140 | words=($line[1] "${words[@]}") | ||
| 141 | (( CURRENT += 1 )) | ||
| 142 | curcontext="${curcontext%:*:*}:rsp-settings-command-$line[1]:" | ||
| 143 | case $line[1] in | ||
| 144 | (get) | ||
| 145 | _arguments "${_arguments_options[@]}" : \ | ||
| 146 | '-h[Print help]' \ | ||
| 147 | '--help[Print help]' \ | ||
| 148 | ':key:_default' \ | ||
| 149 | && ret=0 | ||
| 150 | ;; | ||
| 151 | (set) | ||
| 152 | _arguments "${_arguments_options[@]}" : \ | ||
| 153 | '-h[Print help]' \ | ||
| 154 | '--help[Print help]' \ | ||
| 155 | ':key:_default' \ | ||
| 156 | ':value:_default' \ | ||
| 157 | && ret=0 | ||
| 158 | ;; | ||
| 159 | (list) | ||
| 160 | _arguments "${_arguments_options[@]}" : \ | ||
| 161 | '-h[Print help]' \ | ||
| 162 | '--help[Print help]' \ | ||
| 163 | && ret=0 | ||
| 164 | ;; | ||
| 165 | (unset) | ||
| 166 | _arguments "${_arguments_options[@]}" : \ | ||
| 167 | '-h[Print help]' \ | ||
| 168 | '--help[Print help]' \ | ||
| 169 | ':key:_default' \ | ||
| 170 | && ret=0 | ||
| 171 | ;; | ||
| 172 | (help) | ||
| 173 | _arguments "${_arguments_options[@]}" : \ | ||
| 174 | ":: :_rsp__subcmd__settings__subcmd__help_commands" \ | ||
| 175 | "*::: :->help" \ | ||
| 176 | && ret=0 | ||
| 177 | |||
| 178 | case $state in | ||
| 179 | (help) | ||
| 180 | words=($line[1] "${words[@]}") | ||
| 181 | (( CURRENT += 1 )) | ||
| 182 | curcontext="${curcontext%:*:*}:rsp-settings-help-command-$line[1]:" | ||
| 183 | case $line[1] in | ||
| 184 | (get) | ||
| 185 | _arguments "${_arguments_options[@]}" : \ | ||
| 186 | && ret=0 | ||
| 187 | ;; | ||
| 188 | (set) | ||
| 189 | _arguments "${_arguments_options[@]}" : \ | ||
| 190 | && ret=0 | ||
| 191 | ;; | ||
| 192 | (list) | ||
| 193 | _arguments "${_arguments_options[@]}" : \ | ||
| 194 | && ret=0 | ||
| 195 | ;; | ||
| 196 | (unset) | ||
| 197 | _arguments "${_arguments_options[@]}" : \ | ||
| 198 | && ret=0 | ||
| 199 | ;; | ||
| 200 | (help) | ||
| 201 | _arguments "${_arguments_options[@]}" : \ | ||
| 202 | && ret=0 | ||
| 203 | ;; | ||
| 204 | esac | ||
| 205 | ;; | ||
| 206 | esac | ||
| 207 | ;; | ||
| 208 | esac | ||
| 209 | ;; | ||
| 210 | esac | ||
| 211 | ;; | ||
| 212 | (help) | ||
| 213 | _arguments "${_arguments_options[@]}" : \ | ||
| 214 | ":: :_rsp__subcmd__help_commands" \ | ||
| 215 | "*::: :->help" \ | ||
| 216 | && ret=0 | ||
| 217 | |||
| 218 | case $state in | ||
| 219 | (help) | ||
| 220 | words=($line[1] "${words[@]}") | ||
| 221 | (( CURRENT += 1 )) | ||
| 222 | curcontext="${curcontext%:*:*}:rsp-help-command-$line[1]:" | ||
| 223 | case $line[1] in | ||
| 224 | (start-daemon) | ||
| 225 | _arguments "${_arguments_options[@]}" : \ | ||
| 226 | && ret=0 | ||
| 227 | ;; | ||
| 228 | (stop-daemon) | ||
| 229 | _arguments "${_arguments_options[@]}" : \ | ||
| 230 | && ret=0 | ||
| 231 | ;; | ||
| 232 | (restart) | ||
| 233 | _arguments "${_arguments_options[@]}" : \ | ||
| 234 | && ret=0 | ||
| 235 | ;; | ||
| 236 | (play) | ||
| 237 | _arguments "${_arguments_options[@]}" : \ | ||
| 238 | && ret=0 | ||
| 239 | ;; | ||
| 240 | (pause) | ||
| 241 | _arguments "${_arguments_options[@]}" : \ | ||
| 242 | && ret=0 | ||
| 243 | ;; | ||
| 244 | (resume) | ||
| 245 | _arguments "${_arguments_options[@]}" : \ | ||
| 246 | && ret=0 | ||
| 247 | ;; | ||
| 248 | (toggle) | ||
| 249 | _arguments "${_arguments_options[@]}" : \ | ||
| 250 | && ret=0 | ||
| 251 | ;; | ||
| 252 | (stop) | ||
| 253 | _arguments "${_arguments_options[@]}" : \ | ||
| 254 | && ret=0 | ||
| 255 | ;; | ||
| 256 | (next) | ||
| 257 | _arguments "${_arguments_options[@]}" : \ | ||
| 258 | && ret=0 | ||
| 259 | ;; | ||
| 260 | (previous) | ||
| 261 | _arguments "${_arguments_options[@]}" : \ | ||
| 262 | && ret=0 | ||
| 263 | ;; | ||
| 264 | (volume) | ||
| 265 | _arguments "${_arguments_options[@]}" : \ | ||
| 266 | && ret=0 | ||
| 267 | ;; | ||
| 268 | (shuffle) | ||
| 269 | _arguments "${_arguments_options[@]}" : \ | ||
| 270 | && ret=0 | ||
| 271 | ;; | ||
| 272 | (queue) | ||
| 273 | _arguments "${_arguments_options[@]}" : \ | ||
| 274 | && ret=0 | ||
| 275 | ;; | ||
| 276 | (status) | ||
| 277 | _arguments "${_arguments_options[@]}" : \ | ||
| 278 | && ret=0 | ||
| 279 | ;; | ||
| 280 | (scan) | ||
| 281 | _arguments "${_arguments_options[@]}" : \ | ||
| 282 | && ret=0 | ||
| 283 | ;; | ||
| 284 | (settings) | ||
| 285 | _arguments "${_arguments_options[@]}" : \ | ||
| 286 | ":: :_rsp__subcmd__help__subcmd__settings_commands" \ | ||
| 287 | "*::: :->settings" \ | ||
| 288 | && ret=0 | ||
| 289 | |||
| 290 | case $state in | ||
| 291 | (settings) | ||
| 292 | words=($line[1] "${words[@]}") | ||
| 293 | (( CURRENT += 1 )) | ||
| 294 | curcontext="${curcontext%:*:*}:rsp-help-settings-command-$line[1]:" | ||
| 295 | case $line[1] in | ||
| 296 | (get) | ||
| 297 | _arguments "${_arguments_options[@]}" : \ | ||
| 298 | && ret=0 | ||
| 299 | ;; | ||
| 300 | (set) | ||
| 301 | _arguments "${_arguments_options[@]}" : \ | ||
| 302 | && ret=0 | ||
| 303 | ;; | ||
| 304 | (list) | ||
| 305 | _arguments "${_arguments_options[@]}" : \ | ||
| 306 | && ret=0 | ||
| 307 | ;; | ||
| 308 | (unset) | ||
| 309 | _arguments "${_arguments_options[@]}" : \ | ||
| 310 | && ret=0 | ||
| 311 | ;; | ||
| 312 | esac | ||
| 313 | ;; | ||
| 314 | esac | ||
| 315 | ;; | ||
| 316 | (help) | ||
| 317 | _arguments "${_arguments_options[@]}" : \ | ||
| 318 | && ret=0 | ||
| 319 | ;; | ||
| 320 | esac | ||
| 321 | ;; | ||
| 322 | esac | ||
| 323 | ;; | ||
| 324 | esac | ||
| 325 | ;; | ||
| 326 | esac | ||
| 327 | } | ||
| 328 | |||
| 329 | (( $+functions[_rsp_commands] )) || | ||
| 330 | _rsp_commands() { | ||
| 331 | local commands; commands=( | ||
| 332 | 'start-daemon:Start the daemon' \ | ||
| 333 | 'stop-daemon:Stop the daemon' \ | ||
| 334 | 'restart:Restart the daemon (kill existing and start new)' \ | ||
| 335 | 'play:Play a track, album, or artist' \ | ||
| 336 | 'pause:Pause playback' \ | ||
| 337 | 'resume:Resume playback' \ | ||
| 338 | 'toggle:Toggle play/pause' \ | ||
| 339 | 'stop:Stop playback' \ | ||
| 340 | 'next:Skip to next track' \ | ||
| 341 | 'previous:Skip to previous track' \ | ||
| 342 | 'volume:Set volume (0-100)' \ | ||
| 343 | 'shuffle:Shuffle mode' \ | ||
| 344 | 'queue:Queue management' \ | ||
| 345 | 'status:Show player status' \ | ||
| 346 | 'scan:Scan music paths to populate database' \ | ||
| 347 | 'settings:Settings management' \ | ||
| 348 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 349 | ) | ||
| 350 | _describe -t commands 'rsp commands' commands "$@" | ||
| 351 | } | ||
| 352 | (( $+functions[_rsp__subcmd__help_commands] )) || | ||
| 353 | _rsp__subcmd__help_commands() { | ||
| 354 | local commands; commands=( | ||
| 355 | 'start-daemon:Start the daemon' \ | ||
| 356 | 'stop-daemon:Stop the daemon' \ | ||
| 357 | 'restart:Restart the daemon (kill existing and start new)' \ | ||
| 358 | 'play:Play a track, album, or artist' \ | ||
| 359 | 'pause:Pause playback' \ | ||
| 360 | 'resume:Resume playback' \ | ||
| 361 | 'toggle:Toggle play/pause' \ | ||
| 362 | 'stop:Stop playback' \ | ||
| 363 | 'next:Skip to next track' \ | ||
| 364 | 'previous:Skip to previous track' \ | ||
| 365 | 'volume:Set volume (0-100)' \ | ||
| 366 | 'shuffle:Shuffle mode' \ | ||
| 367 | 'queue:Queue management' \ | ||
| 368 | 'status:Show player status' \ | ||
| 369 | 'scan:Scan music paths to populate database' \ | ||
| 370 | 'settings:Settings management' \ | ||
| 371 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 372 | ) | ||
| 373 | _describe -t commands 'rsp help commands' commands "$@" | ||
| 374 | } | ||
| 375 | (( $+functions[_rsp__subcmd__help__subcmd__help_commands] )) || | ||
| 376 | _rsp__subcmd__help__subcmd__help_commands() { | ||
| 377 | local commands; commands=() | ||
| 378 | _describe -t commands 'rsp help help commands' commands "$@" | ||
| 379 | } | ||
| 380 | (( $+functions[_rsp__subcmd__help__subcmd__next_commands] )) || | ||
| 381 | _rsp__subcmd__help__subcmd__next_commands() { | ||
| 382 | local commands; commands=() | ||
| 383 | _describe -t commands 'rsp help next commands' commands "$@" | ||
| 384 | } | ||
| 385 | (( $+functions[_rsp__subcmd__help__subcmd__pause_commands] )) || | ||
| 386 | _rsp__subcmd__help__subcmd__pause_commands() { | ||
| 387 | local commands; commands=() | ||
| 388 | _describe -t commands 'rsp help pause commands' commands "$@" | ||
| 389 | } | ||
| 390 | (( $+functions[_rsp__subcmd__help__subcmd__play_commands] )) || | ||
| 391 | _rsp__subcmd__help__subcmd__play_commands() { | ||
| 392 | local commands; commands=() | ||
| 393 | _describe -t commands 'rsp help play commands' commands "$@" | ||
| 394 | } | ||
| 395 | (( $+functions[_rsp__subcmd__help__subcmd__previous_commands] )) || | ||
| 396 | _rsp__subcmd__help__subcmd__previous_commands() { | ||
| 397 | local commands; commands=() | ||
| 398 | _describe -t commands 'rsp help previous commands' commands "$@" | ||
| 399 | } | ||
| 400 | (( $+functions[_rsp__subcmd__help__subcmd__queue_commands] )) || | ||
| 401 | _rsp__subcmd__help__subcmd__queue_commands() { | ||
| 402 | local commands; commands=() | ||
| 403 | _describe -t commands 'rsp help queue commands' commands "$@" | ||
| 404 | } | ||
| 405 | (( $+functions[_rsp__subcmd__help__subcmd__restart_commands] )) || | ||
| 406 | _rsp__subcmd__help__subcmd__restart_commands() { | ||
| 407 | local commands; commands=() | ||
| 408 | _describe -t commands 'rsp help restart commands' commands "$@" | ||
| 409 | } | ||
| 410 | (( $+functions[_rsp__subcmd__help__subcmd__resume_commands] )) || | ||
| 411 | _rsp__subcmd__help__subcmd__resume_commands() { | ||
| 412 | local commands; commands=() | ||
| 413 | _describe -t commands 'rsp help resume commands' commands "$@" | ||
| 414 | } | ||
| 415 | (( $+functions[_rsp__subcmd__help__subcmd__scan_commands] )) || | ||
| 416 | _rsp__subcmd__help__subcmd__scan_commands() { | ||
| 417 | local commands; commands=() | ||
| 418 | _describe -t commands 'rsp help scan commands' commands "$@" | ||
| 419 | } | ||
| 420 | (( $+functions[_rsp__subcmd__help__subcmd__settings_commands] )) || | ||
| 421 | _rsp__subcmd__help__subcmd__settings_commands() { | ||
| 422 | local commands; commands=( | ||
| 423 | 'get:Get a setting value' \ | ||
| 424 | 'set:Set a setting value' \ | ||
| 425 | 'list:List all settings' \ | ||
| 426 | 'unset:Unset a setting' \ | ||
| 427 | ) | ||
| 428 | _describe -t commands 'rsp help settings commands' commands "$@" | ||
| 429 | } | ||
| 430 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__get_commands] )) || | ||
| 431 | _rsp__subcmd__help__subcmd__settings__subcmd__get_commands() { | ||
| 432 | local commands; commands=() | ||
| 433 | _describe -t commands 'rsp help settings get commands' commands "$@" | ||
| 434 | } | ||
| 435 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__list_commands] )) || | ||
| 436 | _rsp__subcmd__help__subcmd__settings__subcmd__list_commands() { | ||
| 437 | local commands; commands=() | ||
| 438 | _describe -t commands 'rsp help settings list commands' commands "$@" | ||
| 439 | } | ||
| 440 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__set_commands] )) || | ||
| 441 | _rsp__subcmd__help__subcmd__settings__subcmd__set_commands() { | ||
| 442 | local commands; commands=() | ||
| 443 | _describe -t commands 'rsp help settings set commands' commands "$@" | ||
| 444 | } | ||
| 445 | (( $+functions[_rsp__subcmd__help__subcmd__settings__subcmd__unset_commands] )) || | ||
| 446 | _rsp__subcmd__help__subcmd__settings__subcmd__unset_commands() { | ||
| 447 | local commands; commands=() | ||
| 448 | _describe -t commands 'rsp help settings unset commands' commands "$@" | ||
| 449 | } | ||
| 450 | (( $+functions[_rsp__subcmd__help__subcmd__shuffle_commands] )) || | ||
| 451 | _rsp__subcmd__help__subcmd__shuffle_commands() { | ||
| 452 | local commands; commands=() | ||
| 453 | _describe -t commands 'rsp help shuffle commands' commands "$@" | ||
| 454 | } | ||
| 455 | (( $+functions[_rsp__subcmd__help__subcmd__start-daemon_commands] )) || | ||
| 456 | _rsp__subcmd__help__subcmd__start-daemon_commands() { | ||
| 457 | local commands; commands=() | ||
| 458 | _describe -t commands 'rsp help start-daemon commands' commands "$@" | ||
| 459 | } | ||
| 460 | (( $+functions[_rsp__subcmd__help__subcmd__status_commands] )) || | ||
| 461 | _rsp__subcmd__help__subcmd__status_commands() { | ||
| 462 | local commands; commands=() | ||
| 463 | _describe -t commands 'rsp help status commands' commands "$@" | ||
| 464 | } | ||
| 465 | (( $+functions[_rsp__subcmd__help__subcmd__stop_commands] )) || | ||
| 466 | _rsp__subcmd__help__subcmd__stop_commands() { | ||
| 467 | local commands; commands=() | ||
| 468 | _describe -t commands 'rsp help stop commands' commands "$@" | ||
| 469 | } | ||
| 470 | (( $+functions[_rsp__subcmd__help__subcmd__stop-daemon_commands] )) || | ||
| 471 | _rsp__subcmd__help__subcmd__stop-daemon_commands() { | ||
| 472 | local commands; commands=() | ||
| 473 | _describe -t commands 'rsp help stop-daemon commands' commands "$@" | ||
| 474 | } | ||
| 475 | (( $+functions[_rsp__subcmd__help__subcmd__toggle_commands] )) || | ||
| 476 | _rsp__subcmd__help__subcmd__toggle_commands() { | ||
| 477 | local commands; commands=() | ||
| 478 | _describe -t commands 'rsp help toggle commands' commands "$@" | ||
| 479 | } | ||
| 480 | (( $+functions[_rsp__subcmd__help__subcmd__volume_commands] )) || | ||
| 481 | _rsp__subcmd__help__subcmd__volume_commands() { | ||
| 482 | local commands; commands=() | ||
| 483 | _describe -t commands 'rsp help volume commands' commands "$@" | ||
| 484 | } | ||
| 485 | (( $+functions[_rsp__subcmd__next_commands] )) || | ||
| 486 | _rsp__subcmd__next_commands() { | ||
| 487 | local commands; commands=() | ||
| 488 | _describe -t commands 'rsp next commands' commands "$@" | ||
| 489 | } | ||
| 490 | (( $+functions[_rsp__subcmd__pause_commands] )) || | ||
| 491 | _rsp__subcmd__pause_commands() { | ||
| 492 | local commands; commands=() | ||
| 493 | _describe -t commands 'rsp pause commands' commands "$@" | ||
| 494 | } | ||
| 495 | (( $+functions[_rsp__subcmd__play_commands] )) || | ||
| 496 | _rsp__subcmd__play_commands() { | ||
| 497 | local commands; commands=() | ||
| 498 | _describe -t commands 'rsp play commands' commands "$@" | ||
| 499 | } | ||
| 500 | (( $+functions[_rsp__subcmd__previous_commands] )) || | ||
| 501 | _rsp__subcmd__previous_commands() { | ||
| 502 | local commands; commands=() | ||
| 503 | _describe -t commands 'rsp previous commands' commands "$@" | ||
| 504 | } | ||
| 505 | (( $+functions[_rsp__subcmd__queue_commands] )) || | ||
| 506 | _rsp__subcmd__queue_commands() { | ||
| 507 | local commands; commands=() | ||
| 508 | _describe -t commands 'rsp queue commands' commands "$@" | ||
| 509 | } | ||
| 510 | (( $+functions[_rsp__subcmd__restart_commands] )) || | ||
| 511 | _rsp__subcmd__restart_commands() { | ||
| 512 | local commands; commands=() | ||
| 513 | _describe -t commands 'rsp restart commands' commands "$@" | ||
| 514 | } | ||
| 515 | (( $+functions[_rsp__subcmd__resume_commands] )) || | ||
| 516 | _rsp__subcmd__resume_commands() { | ||
| 517 | local commands; commands=() | ||
| 518 | _describe -t commands 'rsp resume commands' commands "$@" | ||
| 519 | } | ||
| 520 | (( $+functions[_rsp__subcmd__scan_commands] )) || | ||
| 521 | _rsp__subcmd__scan_commands() { | ||
| 522 | local commands; commands=() | ||
| 523 | _describe -t commands 'rsp scan commands' commands "$@" | ||
| 524 | } | ||
| 525 | (( $+functions[_rsp__subcmd__settings_commands] )) || | ||
| 526 | _rsp__subcmd__settings_commands() { | ||
| 527 | local commands; commands=( | ||
| 528 | 'get:Get a setting value' \ | ||
| 529 | 'set:Set a setting value' \ | ||
| 530 | 'list:List all settings' \ | ||
| 531 | 'unset:Unset a setting' \ | ||
| 532 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 533 | ) | ||
| 534 | _describe -t commands 'rsp settings commands' commands "$@" | ||
| 535 | } | ||
| 536 | (( $+functions[_rsp__subcmd__settings__subcmd__get_commands] )) || | ||
| 537 | _rsp__subcmd__settings__subcmd__get_commands() { | ||
| 538 | local commands; commands=() | ||
| 539 | _describe -t commands 'rsp settings get commands' commands "$@" | ||
| 540 | } | ||
| 541 | (( $+functions[_rsp__subcmd__settings__subcmd__help_commands] )) || | ||
| 542 | _rsp__subcmd__settings__subcmd__help_commands() { | ||
| 543 | local commands; commands=( | ||
| 544 | 'get:Get a setting value' \ | ||
| 545 | 'set:Set a setting value' \ | ||
| 546 | 'list:List all settings' \ | ||
| 547 | 'unset:Unset a setting' \ | ||
| 548 | 'help:Print this message or the help of the given subcommand(s)' \ | ||
| 549 | ) | ||
| 550 | _describe -t commands 'rsp settings help commands' commands "$@" | ||
| 551 | } | ||
| 552 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__get_commands] )) || | ||
| 553 | _rsp__subcmd__settings__subcmd__help__subcmd__get_commands() { | ||
| 554 | local commands; commands=() | ||
| 555 | _describe -t commands 'rsp settings help get commands' commands "$@" | ||
| 556 | } | ||
| 557 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__help_commands] )) || | ||
| 558 | _rsp__subcmd__settings__subcmd__help__subcmd__help_commands() { | ||
| 559 | local commands; commands=() | ||
| 560 | _describe -t commands 'rsp settings help help commands' commands "$@" | ||
| 561 | } | ||
| 562 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__list_commands] )) || | ||
| 563 | _rsp__subcmd__settings__subcmd__help__subcmd__list_commands() { | ||
| 564 | local commands; commands=() | ||
| 565 | _describe -t commands 'rsp settings help list commands' commands "$@" | ||
| 566 | } | ||
| 567 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__set_commands] )) || | ||
| 568 | _rsp__subcmd__settings__subcmd__help__subcmd__set_commands() { | ||
| 569 | local commands; commands=() | ||
| 570 | _describe -t commands 'rsp settings help set commands' commands "$@" | ||
| 571 | } | ||
| 572 | (( $+functions[_rsp__subcmd__settings__subcmd__help__subcmd__unset_commands] )) || | ||
| 573 | _rsp__subcmd__settings__subcmd__help__subcmd__unset_commands() { | ||
| 574 | local commands; commands=() | ||
| 575 | _describe -t commands 'rsp settings help unset commands' commands "$@" | ||
| 576 | } | ||
| 577 | (( $+functions[_rsp__subcmd__settings__subcmd__list_commands] )) || | ||
| 578 | _rsp__subcmd__settings__subcmd__list_commands() { | ||
| 579 | local commands; commands=() | ||
| 580 | _describe -t commands 'rsp settings list commands' commands "$@" | ||
| 581 | } | ||
| 582 | (( $+functions[_rsp__subcmd__settings__subcmd__set_commands] )) || | ||
| 583 | _rsp__subcmd__settings__subcmd__set_commands() { | ||
| 584 | local commands; commands=() | ||
| 585 | _describe -t commands 'rsp settings set commands' commands "$@" | ||
| 586 | } | ||
| 587 | (( $+functions[_rsp__subcmd__settings__subcmd__unset_commands] )) || | ||
| 588 | _rsp__subcmd__settings__subcmd__unset_commands() { | ||
| 589 | local commands; commands=() | ||
| 590 | _describe -t commands 'rsp settings unset commands' commands "$@" | ||
| 591 | } | ||
| 592 | (( $+functions[_rsp__subcmd__shuffle_commands] )) || | ||
| 593 | _rsp__subcmd__shuffle_commands() { | ||
| 594 | local commands; commands=() | ||
| 595 | _describe -t commands 'rsp shuffle commands' commands "$@" | ||
| 596 | } | ||
| 597 | (( $+functions[_rsp__subcmd__start-daemon_commands] )) || | ||
| 598 | _rsp__subcmd__start-daemon_commands() { | ||
| 599 | local commands; commands=() | ||
| 600 | _describe -t commands 'rsp start-daemon commands' commands "$@" | ||
| 601 | } | ||
| 602 | (( $+functions[_rsp__subcmd__status_commands] )) || | ||
| 603 | _rsp__subcmd__status_commands() { | ||
| 604 | local commands; commands=() | ||
| 605 | _describe -t commands 'rsp status commands' commands "$@" | ||
| 606 | } | ||
| 607 | (( $+functions[_rsp__subcmd__stop_commands] )) || | ||
| 608 | _rsp__subcmd__stop_commands() { | ||
| 609 | local commands; commands=() | ||
| 610 | _describe -t commands 'rsp stop commands' commands "$@" | ||
| 611 | } | ||
| 612 | (( $+functions[_rsp__subcmd__stop-daemon_commands] )) || | ||
| 613 | _rsp__subcmd__stop-daemon_commands() { | ||
| 614 | local commands; commands=() | ||
| 615 | _describe -t commands 'rsp stop-daemon commands' commands "$@" | ||
| 616 | } | ||
| 617 | (( $+functions[_rsp__subcmd__toggle_commands] )) || | ||
| 618 | _rsp__subcmd__toggle_commands() { | ||
| 619 | local commands; commands=() | ||
| 620 | _describe -t commands 'rsp toggle commands' commands "$@" | ||
| 621 | } | ||
| 622 | (( $+functions[_rsp__subcmd__volume_commands] )) || | ||
| 623 | _rsp__subcmd__volume_commands() { | ||
| 624 | local commands; commands=() | ||
| 625 | _describe -t commands 'rsp volume commands' commands "$@" | ||
| 626 | } | ||
| 627 | |||
| 628 | if [ "$funcstack[1]" = "_rsp" ]; then | ||
| 629 | _rsp "$@" | ||
| 630 | else | ||
| 631 | compdef _rsp rsp | ||
| 632 | fi | ||
| @@ -28,28 +28,27 @@ fi | |||
| 28 | 28 | ||
| 29 | echo "" | 29 | echo "" |
| 30 | echo "Installing shell completions..." | 30 | echo "Installing shell completions..." |
| 31 | SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" | ||
| 32 | shell_name=$(basename "${SHELL:-}") | 31 | shell_name=$(basename "${SHELL:-}") |
| 33 | case "$shell_name" in | 32 | case "$shell_name" in |
| 34 | bash) | 33 | bash) |
| 35 | dest="${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions" | 34 | dest="${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions" |
| 36 | mkdir -p "$dest" | 35 | mkdir -p "$dest" |
| 37 | cp "$SCRIPT_DIR/completions/rsp.bash" "$dest/rsp" | 36 | /usr/bin/rsp completions bash > "$dest/rsp" |
| 38 | echo " → Bash completions: $dest/rsp" | 37 | echo " → Bash completions: $dest/rsp" |
| 39 | ;; | 38 | ;; |
| 40 | zsh) | 39 | zsh) |
| 41 | dest="/usr/share/zsh/site-functions/_rsp" | 40 | dest="/usr/share/zsh/site-functions/_rsp" |
| 42 | sudo cp "$SCRIPT_DIR/completions/rsp.zsh" "$dest" | 41 | /usr/bin/rsp completions zsh | sudo tee "$dest" > /dev/null |
| 43 | echo " → Zsh completions: $dest" | 42 | echo " → Zsh completions: $dest" |
| 44 | ;; | 43 | ;; |
| 45 | fish) | 44 | fish) |
| 46 | dest="$HOME/.config/fish/completions/rsp.fish" | 45 | dest="$HOME/.config/fish/completions/rsp.fish" |
| 47 | mkdir -p "$(dirname "$dest")" | 46 | mkdir -p "$(dirname "$dest")" |
| 48 | cp "$SCRIPT_DIR/completions/rsp.fish" "$dest" | 47 | /usr/bin/rsp completions fish > "$dest" |
| 49 | echo " → Fish completions: $dest" | 48 | echo " → Fish completions: $dest" |
| 50 | ;; | 49 | ;; |
| 51 | *) | 50 | *) |
| 52 | echo " → Unrecognized shell '$shell_name'; completion files are in $SCRIPT_DIR/completions/" | 51 | echo " → Unrecognized shell '$shell_name'; generate with: rsp completions <bash|zsh|fish|powershell|elvish>" |
| 53 | ;; | 52 | ;; |
| 54 | esac | 53 | esac |
| 55 | 54 | ||
| @@ -1,6 +1,6 @@ | |||
| 1 | use crate::config::Config; | 1 | use crate::config::Config; |
| 2 | use crate::database::Database; | 2 | use crate::database::Database; |
| 3 | use clap::{CommandFactory, Parser, Subcommand}; | 3 | use clap::{Command, CommandFactory, Parser, Subcommand}; |
| 4 | use clap_complete::{Shell, generate}; | 4 | use clap_complete::{Shell, generate}; |
| 5 | use std::path::PathBuf; | 5 | use std::path::PathBuf; |
| 6 | 6 | ||
| @@ -218,7 +218,21 @@ impl Cli { | |||
| 218 | } | 218 | } |
| 219 | } | 219 | } |
| 220 | Commands::Completions { shell } => { | 220 | Commands::Completions { shell } => { |
| 221 | let mut cmd = Cli::command(); | 221 | let full = Cli::command(); |
| 222 | let subcommands: Vec<Command> = full | ||
| 223 | .get_subcommands() | ||
| 224 | .filter(|s| s.get_name() != "completions") | ||
| 225 | .cloned() | ||
| 226 | .collect(); | ||
| 227 | let cmd_name = full.get_name().to_string(); | ||
| 228 | let about = full.get_about().cloned(); | ||
| 229 | let mut cmd = Command::new(cmd_name).infer_long_args(true); | ||
| 230 | if let Some(a) = about { | ||
| 231 | cmd = cmd.about(a); | ||
| 232 | } | ||
| 233 | for sc in subcommands { | ||
| 234 | cmd = cmd.subcommand(sc); | ||
| 235 | } | ||
| 222 | if let Some(s) = shell { | 236 | if let Some(s) = shell { |
| 223 | let shell = match s.as_str() { | 237 | let shell = match s.as_str() { |
| 224 | "bash" => Shell::Bash, | 238 | "bash" => Shell::Bash, |
