From 03f4585424d05dd50022759c7ad098fe06277f6e Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 7 May 2026 16:16:01 +0200 Subject: 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 --- completions/rsp.bash | 920 ++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 906 insertions(+), 14 deletions(-) (limited to 'completions/rsp.bash') 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 @@ -#!/usr/bin/env bash +_rsp_play_query_completions() { + local cur="${COMP_WORDS[COMP_CWORD]}" + # Only do dynamic completion if COMPREPLY is empty (no flag matched) + # and the current word doesn't start with - + if [[ ${#COMPREPLY[@]} -eq 0 && "$cur" != -* ]]; then + local -a artists + artists=($(rsp play --list 2>/dev/null)) + COMPREPLY=( $(compgen -W "${artists[*]}" -- "$cur") ) + fi +} _rsp() { - local cur prev words cword - _init_completion || return + local i cur prev opts cmd + COMPREPLY=() + if [[ "${BASH_VERSINFO[0]}" -ge 4 ]]; then + cur="$2" + else + cur="${COMP_WORDS[COMP_CWORD]}" + fi + prev="$3" + cmd="" + opts="" + + for i in "${COMP_WORDS[@]:0:COMP_CWORD}" + do + case "${cmd},${i}" in + ",$1") + cmd="rsp" + ;; + rsp,completions) + cmd="rsp__subcmd__completions" + ;; + rsp,help) + cmd="rsp__subcmd__help" + ;; + rsp,next) + cmd="rsp__subcmd__next" + ;; + rsp,pause) + cmd="rsp__subcmd__pause" + ;; + rsp,play) + cmd="rsp__subcmd__play" + ;; + rsp,previous) + cmd="rsp__subcmd__previous" + ;; + rsp,queue) + cmd="rsp__subcmd__queue" + ;; + rsp,restart) + cmd="rsp__subcmd__restart" + ;; + rsp,resume) + cmd="rsp__subcmd__resume" + ;; + rsp,scan) + cmd="rsp__subcmd__scan" + ;; + rsp,settings) + cmd="rsp__subcmd__settings" + ;; + rsp,shuffle) + cmd="rsp__subcmd__shuffle" + ;; + rsp,start) + cmd="rsp__subcmd__start" + ;; + rsp,status) + cmd="rsp__subcmd__status" + ;; + rsp,stop) + cmd="rsp__subcmd__stop" + ;; + rsp,stop-playback) + cmd="rsp__subcmd__stop__subcmd__playback" + ;; + rsp,toggle) + cmd="rsp__subcmd__toggle" + ;; + rsp,volume) + cmd="rsp__subcmd__volume" + ;; + rsp__subcmd__help,completions) + cmd="rsp__subcmd__help__subcmd__completions" + ;; + rsp__subcmd__help,help) + cmd="rsp__subcmd__help__subcmd__help" + ;; + rsp__subcmd__help,next) + cmd="rsp__subcmd__help__subcmd__next" + ;; + rsp__subcmd__help,pause) + cmd="rsp__subcmd__help__subcmd__pause" + ;; + rsp__subcmd__help,play) + cmd="rsp__subcmd__help__subcmd__play" + ;; + rsp__subcmd__help,previous) + cmd="rsp__subcmd__help__subcmd__previous" + ;; + rsp__subcmd__help,queue) + cmd="rsp__subcmd__help__subcmd__queue" + ;; + rsp__subcmd__help,restart) + cmd="rsp__subcmd__help__subcmd__restart" + ;; + rsp__subcmd__help,resume) + cmd="rsp__subcmd__help__subcmd__resume" + ;; + rsp__subcmd__help,scan) + cmd="rsp__subcmd__help__subcmd__scan" + ;; + rsp__subcmd__help,settings) + cmd="rsp__subcmd__help__subcmd__settings" + ;; + rsp__subcmd__help,shuffle) + cmd="rsp__subcmd__help__subcmd__shuffle" + ;; + rsp__subcmd__help,start) + cmd="rsp__subcmd__help__subcmd__start" + ;; + rsp__subcmd__help,status) + cmd="rsp__subcmd__help__subcmd__status" + ;; + rsp__subcmd__help,stop) + cmd="rsp__subcmd__help__subcmd__stop" + ;; + rsp__subcmd__help,stop-playback) + cmd="rsp__subcmd__help__subcmd__stop__subcmd__playback" + ;; + rsp__subcmd__help,toggle) + cmd="rsp__subcmd__help__subcmd__toggle" + ;; + rsp__subcmd__help,volume) + cmd="rsp__subcmd__help__subcmd__volume" + ;; + rsp__subcmd__help__subcmd__settings,get) + cmd="rsp__subcmd__help__subcmd__settings__subcmd__get" + ;; + rsp__subcmd__help__subcmd__settings,list) + cmd="rsp__subcmd__help__subcmd__settings__subcmd__list" + ;; + rsp__subcmd__help__subcmd__settings,set) + cmd="rsp__subcmd__help__subcmd__settings__subcmd__set" + ;; + rsp__subcmd__help__subcmd__settings,unset) + cmd="rsp__subcmd__help__subcmd__settings__subcmd__unset" + ;; + rsp__subcmd__settings,get) + cmd="rsp__subcmd__settings__subcmd__get" + ;; + rsp__subcmd__settings,help) + cmd="rsp__subcmd__settings__subcmd__help" + ;; + rsp__subcmd__settings,list) + cmd="rsp__subcmd__settings__subcmd__list" + ;; + rsp__subcmd__settings,set) + cmd="rsp__subcmd__settings__subcmd__set" + ;; + rsp__subcmd__settings,unset) + cmd="rsp__subcmd__settings__subcmd__unset" + ;; + rsp__subcmd__settings__subcmd__help,get) + cmd="rsp__subcmd__settings__subcmd__help__subcmd__get" + ;; + rsp__subcmd__settings__subcmd__help,help) + cmd="rsp__subcmd__settings__subcmd__help__subcmd__help" + ;; + rsp__subcmd__settings__subcmd__help,list) + cmd="rsp__subcmd__settings__subcmd__help__subcmd__list" + ;; + rsp__subcmd__settings__subcmd__help,set) + cmd="rsp__subcmd__settings__subcmd__help__subcmd__set" + ;; + rsp__subcmd__settings__subcmd__help,unset) + cmd="rsp__subcmd__settings__subcmd__help__subcmd__unset" + ;; + *) + ;; + esac + done - case $prev in + case "${cmd}" in rsp) - COMPREPLY=($(compgen -W "start stop restart play pause resume toggle next previous volume shuffle queue status scan settings" -- "$cur")) + opts="-h --help start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__completions) + opts="-h --shell --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --shell) + COMPREPLY=($(compgen -W "bash elvish fish powershell zsh" -- "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help) + opts="start stop restart play pause resume toggle stop-playback next previous volume shuffle queue status scan settings completions help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__completions) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__help) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__next) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__pause) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__play) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__previous) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__queue) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__restart) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__resume) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__scan) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__settings) + opts="get set list unset" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__settings__subcmd__get) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__settings__subcmd__list) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__settings__subcmd__set) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__settings__subcmd__unset) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__shuffle) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__start) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__status) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__stop) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__stop__subcmd__playback) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__toggle) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__help__subcmd__volume) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__next) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__pause) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__play) + opts="-i -n -l -L -h --now --next --last --list --help [QUERY]" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + + # Dynamic artist/album completion for query argument + _rsp_play_query_completions +return 0 + ;; + rsp__subcmd__previous) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__queue) + opts="-h --help [POSITION] [QUERY]" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__restart) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__resume) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__scan) + opts="-h --force --paths --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + --paths) + COMPREPLY=($(compgen -f "${cur}")) + return 0 + ;; + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings) + opts="-h --help get set list unset help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__get) + opts="-h --help " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__help) + opts="get set list unset help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__help__subcmd__get) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__help__subcmd__help) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__help__subcmd__list) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__help__subcmd__set) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__help__subcmd__unset) + opts="" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 4 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__list) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__set) + opts="-h --help " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__settings__subcmd__unset) + opts="-h --help " + if [[ ${cur} == -* || ${COMP_CWORD} -eq 3 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__shuffle) + opts="-h --help [MODE]" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__start) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + ;; + rsp__subcmd__status) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 ;; - play) - _filedir + rsp__subcmd__stop) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 ;; - volume) - COMPREPLY=($(compgen -W "0 10 20 30 40 50 60 70 80 90 100" -- "$cur")) + rsp__subcmd__stop__subcmd__playback) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 ;; - shuffle) - COMPREPLY=($(compgen -W "on off album" -- "$cur")) + rsp__subcmd__toggle) + opts="-h --help" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 ;; - settings) - COMPREPLY=($(compgen -W "get set list unset" -- "$cur")) + rsp__subcmd__volume) + opts="-h --help [LEVEL]" + if [[ ${cur} == -* || ${COMP_CWORD} -eq 2 ]] ; then + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 + fi + case "${prev}" in + *) + COMPREPLY=() + ;; + esac + COMPREPLY=( $(compgen -W "${opts}" -- "${cur}") ) + return 0 ;; esac } -complete -F _rsp rsp +if [[ "${BASH_VERSINFO[0]}" -eq 4 && "${BASH_VERSINFO[1]}" -ge 4 || "${BASH_VERSINFO[0]}" -gt 4 ]]; then + complete -F _rsp -o nosort -o bashdefault -o default rsp +else + complete -F _rsp -o bashdefault -o default rsp +fi -- cgit v1.2.3