Don't error if file doesn't have the specified key

This commit is contained in:
Ilan Cosman 2021-01-10 09:10:04 -08:00
parent 4129099cd2
commit 9ceba3d423
2 changed files with 12 additions and 1 deletions

10
blah Normal file
View File

@ -0,0 +1,10 @@
NAME="Garuda Linux"
PRETTY_NAME="Garuda Linux"
ID=garuda
BUILD_ID=rolling
ANSI_COLOR="38;2;23;147;209"
HOME_URL="https://garudalinux.org/"
DOCUMENTATION_URL="https://wiki.garudalinux.org/"
SUPPORT_URL="https://forum.garudalinux.org/"
BUG_REPORT_URL="https://gitlab.com/groups/garuda-linux/"
LOGO=garudalinux

View File

@ -18,7 +18,8 @@ function _tide_detect_os_linux_cases -a file key
test -f $file || return test -f $file || return
set -l splitOsRelease (cat $file | string split '=') set -l splitOsRelease (cat $file | string split '=')
set -l value $splitOsRelease[(math (contains --index $key $splitOsRelease)+1)] set -l keyIndex (contains --index $key $splitOsRelease) || return
set -l value $splitOsRelease[(math $keyIndex + 1)]
set -l name (string trim --chars='"' $value | string lower) set -l name (string trim --chars='"' $value | string lower)
switch $name switch $name