added auto-completion for installing dxvk/vkd3d

This commit is contained in:
Sergey Palcheh
2025-09-09 13:31:39 +06:00
parent 721fd5e76e
commit 13efa924d8
2 changed files with 19 additions and 1 deletions

View File

@@ -4,7 +4,7 @@ _winehelper_completions() {
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 create-prefix --changelog changelog"
opts="--help --version --debug install installed install-dxvk install-vkd3d -r -i remove-all --clear-pfx killall remove-prefix backup-prefix restore-prefix create-prefix --changelog changelog"
wine_cmd="winecfg winereg winefile wineconsole winetricks desktop regedit explorer cmd run"
case "${prev}" in

View File

@@ -8,6 +8,8 @@ _winehelper() {
'--version[Показать информацию о пакете и его версии]'
'--debug[Режим отладки]'
'install[Запустить скрипт установки программы]'
'install-dxvk[Установить/удалить DXVK]'
'install-vkd3d[Установить/удалить VKD3D]'
'installed[Список установленных программ]'
'-r[Запуск программы (отладка)]'
'-i[Запустить скрипт установки программы]'
@@ -61,6 +63,12 @@ _winehelper() {
restore-prefix)
_files
;;
install-dxvk)
_get_component_versions 'install-dxvk'
;;
install-vkd3d)
_get_component_versions 'install-vkd3d'
;;
*)
_values 'winehelper options' "${opts[@]}" "${wine_cmd[@]}"
;;
@@ -69,6 +77,16 @@ _winehelper() {
esac
}
_get_component_versions () {
local component_command=$1
local -a versions
versions=( ${(f)"$(winehelper "${component_command}" list 2>/dev/null | grep ' - ' | sed 's/ - //')" } )
versions+=(none list)
_values 'versions' "${versions[@]}"
}
_get_prefixes () {
prefixes=( ${(f)"$(ls -1 ~/.local/share/winehelper/prefixes 2>/dev/null)"} )