# Auto-completion for winehelper _winehelper_completions() { local cur prev opts COMPREPLY=() cur="${COMP_WORDS[COMP_CWORD]}" prev="${COMP_WORDS[COMP_CWORD-1]}" opts="--help --version --debug install installed -r -i remove-all --clear-pfx killall remove-prefix backup-prefix restore-prefix" wine_cmd="winecfg winereg winefile wineconsole winetricks desktop regedit explorer cmd run" case "${prev}" in winehelper) COMPREPLY=( $(compgen -W "${opts} ${wine_cmd}" -- "${cur}") ) return 0 ;; --debug) COMPREPLY=( $(compgen -W "${wine_cmd}" -- "${cur}") ) return 0 ;; install|-i) local scripts="$(ls -1 /usr/share/winehelper/autoinstall) $(ls -1 /usr/share/winehelper/manualinstall)" COMPREPLY=( $(compgen -W "list ${scripts}" -- "${cur}") ) return 0 ;; run|installed) local installed=$(ls -1 ~/.local/share/winehelper/ | grep ".desktop" | sed 's/.desktop//') COMPREPLY=( $(compgen -W "${installed}" -- "${cur}") ) return 0 ;; remove-prefix|backup-prefix) local prefixes=$(ls -1 ~/.local/share/winehelper/prefixes 2>/dev/null) COMPREPLY=( $(compgen -W "${prefixes}" -- "${cur}") ) return 0 ;; restore-prefix) return 0 ;; *) ;; esac } complete -F _winehelper_completions winehelper