tide/functions/_tide_item_status.fish

21 lines
1.2 KiB
Fish
Raw Normal View History

2020-05-20 20:05:33 +03:00
function _tide_item_status
2021-07-03 21:24:29 +03:00
# Variables are exported as strings, convert _tide_last_pipestatus back into a list
set -l _tide_last_pipestatus (string split ' ' $_tide_last_pipestatus)
2021-03-02 20:46:40 +03:00
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
2021-07-03 21:24:29 +03:00
contains character $tide_left_prompt_items || tide_status_bg_color=$tide_status_bg_color_failure \
tide_status_color=$tide_status_color_failure _tide_print_item status $tide_status_icon_failure' ' 1
2021-05-13 22:44:48 +03:00
else if test $_tide_last_status = 0
2021-07-07 01:41:52 +03:00
_tide_print_item status $tide_status_icon' ' \
2021-05-13 22:44:48 +03:00
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
2020-07-03 20:27:10 +03:00
else
2021-07-03 21:24:29 +03:00
tide_status_bg_color=$tide_status_bg_color_failure tide_status_color=$tide_status_color_failure \
2021-06-30 00:59:35 +03:00
_tide_print_item status $tide_status_icon_failure' ' \
2021-05-13 22:44:48 +03:00
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
2020-11-25 01:30:45 +03:00
end
2021-04-25 03:42:12 +03:00
else if not contains character $tide_left_prompt_items
2021-07-07 01:41:52 +03:00
_tide_print_item status $tide_status_icon
end
2021-03-02 20:46:40 +03:00
end