Skip to content

Commit

Permalink
Add support for lsb-release in detect_os (fixes #24)
Browse files Browse the repository at this point in the history
  • Loading branch information
IlanCosman committed Sep 11, 2020
1 parent 187846c commit 318bfec
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 11 deletions.
16 changes: 9 additions & 7 deletions functions/_tide_detect_os.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ function _tide_detect_os
case freebsd openbsd dragonfly
set -g _tide_os_icon 
case linux
if _tide_detect_os_linux_cases (_tide_detect_os_extract_os_release_info ID)
else if test "$tide_os_use_nearest" = 'true' &&
_tide_detect_os_linux_cases (_tide_detect_os_extract_os_release_info ID_LIKE)
if _tide_detect_os_linux_cases (_tide_detect_os_get_info /etc/os-release ID)
else if _tide_detect_os_linux_cases (_tide_detect_os_get_info /etc/os-release ID_LIKE)
else if _tide_detect_os_linux_cases (_tide_detect_os_get_info /etc/lsb-release DISTRIB_ID)
else
set -g _tide_os_icon 
end
Expand Down Expand Up @@ -50,9 +50,11 @@ function _tide_detect_os_linux_cases -a name
return 0 # If we didn't run into the catch case '*', then return succesfull
end

function _tide_detect_os_extract_os_release_info -a key
set -l splitOsRelease (cat /etc/os-release | string split '=')
set -l value $splitOsRelease[(math (contains --index $key $splitOsRelease)+1)]
function _tide_detect_os_get_info -a file key
if test -e $file
set -l splitOsRelease (cat $file | string split '=')
set -l value $splitOsRelease[(math (contains --index $key $splitOsRelease)+1)]

string trim --chars='"' $value | string lower
string trim --chars='"' $value | string lower
end
end
1 change: 0 additions & 1 deletion tide_theme/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ tide_nvm_default_node
tide_nvm_icon ''
tide_os_bg_color 444444
tide_os_color EEEEEE
tide_os_use_nearest true
tide_print_newline_before_prompt 'true'
tide_prompt_char_bg_color normal
tide_prompt_char_failure_color FF0000
Expand Down
1 change: 0 additions & 1 deletion tide_theme/configure/configs/lean.fish
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ tide_nvm_default_node
tide_nvm_icon ''
tide_os_bg_color normal
tide_os_color normal
tide_os_use_nearest true
tide_print_newline_before_prompt 'true'
tide_prompt_char_bg_color normal
tide_prompt_char_failure_color FF0000
Expand Down
1 change: 0 additions & 1 deletion tide_theme/configure/configs/pure.fish
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ tide_nvm_default_node
tide_nvm_icon ''
tide_os_bg_color normal
tide_os_color normal
tide_os_use_nearest true
tide_print_newline_before_prompt 'true'
tide_prompt_char_bg_color normal
tide_prompt_char_failure_color red
Expand Down
1 change: 0 additions & 1 deletion tide_theme/configure/configs/rainbow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ tide_nvm_default_node
tide_nvm_icon ''
tide_os_bg_color CED7CF
tide_os_color 080808
tide_os_use_nearest true
tide_print_newline_before_prompt 'true'
tide_prompt_char_bg_color normal
tide_prompt_char_failure_color FF0000
Expand Down

0 comments on commit 318bfec

Please sign in to comment.