tide/functions/_tide_item_status.fish
2021-05-20 08:46:39 -07:00

26 lines
1.4 KiB
Fish

function _tide_item_status
if string match --quiet --invert 0 $_tide_last_pipestatus # If there is a failure anywhere in the pipestatus
if test "$_tide_last_pipestatus" = 1 # If simple failure
if not contains character $tide_left_prompt_items
set -g tide_status_bg_color $tide_status_bg_color_failure
set -g tide_status_color $tide_status_color_failure
_tide_print_item status $tide_status_icon_failure' ' 1
end
else if test $_tide_last_status = 0
set -g tide_status_bg_color $tide_status_bg_color_success
set -g tide_status_color $tide_status_color_success
_tide_print_item status $tide_status_icon_success' ' \
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
else
set -g tide_status_bg_color $tide_status_bg_color_failure
set -g tide_status_color $tide_status_color_failure
_tide_print_item status $tide_status_icon_failure' ' \
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
end
else if not contains character $tide_left_prompt_items
set -g tide_status_bg_color $tide_status_bg_color_success
set -g tide_status_color $tide_status_color_success
_tide_print_item status $tide_status_icon_success
end
end