Retool _tide_detect_os_linux_cases and add new distros

This commit is contained in:
Ilan Cosman 2021-03-21 22:25:50 -07:00
parent 6ce2e4a632
commit c6a1ad45c7

View File

@ -18,37 +18,30 @@ function _tide_detect_os_linux_cases -a file key
test -e $file || return
set -l splitFile (string split '=' <$file)
set -l keyIndex (contains --index $key $splitFile) || return
set -l value $splitFile[(math $keyIndex + 1)]
set -l value (string trim --chars='"' $splitFile[(math $keyIndex + 1)] | string lower)
switch (string trim --chars='"' $value | string lower)
case alpine
set -gx _tide_os_icon
case arch
set -gx _tide_os_icon
case centos
set -gx _tide_os_icon
case debian
set -gx _tide_os_icon
case elementary
set -gx _tide_os_icon
case fedora
set -gx _tide_os_icon
case gentoo
set -gx _tide_os_icon
case linuxmint
set -gx _tide_os_icon
case manjaro
set -gx _tide_os_icon
case nixos
set -gx _tide_os_icon
case opensuse tumbleweed
set -gx _tide_os_icon
case raspbian
set -gx _tide_os_icon
case ubuntu
set -gx _tide_os_icon
case '*'
return 1
end
return 0 # If we didn't run into the catch case '*' return succesfull
set -l distroIcons \
alpine  \
aosc  \
arch  \
centos  \
coreos  \
debian  \
devuan  \
elementary  \
fedora  \
gentoo  \
mageia  \
manjaro  \
mint  \
nixos  \
opensuse  \
raspbian  \
sabayon  \
slackware  \
tumbleweed  \
ubuntu
set -l distroIndex (contains --index $value $distroIcons) || return
set -gx _tide_os_icon $distroIcons[(math $distroIndex + 1)]
end