Add tide_status_display

This commit is contained in:
Mickaël Bourgier 2024-04-02 00:56:01 +02:00
parent 44c521ab29
commit 8faea68e01
5 changed files with 24 additions and 2 deletions

View File

@ -1,7 +1,7 @@
function _tide_item_status function _tide_item_status
if string match -qv 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus if string match -qv 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus
if test "$_tide_pipestatus" = 1 # If simple failure if test "$_tide_pipestatus" = 1 # If simple failure
contains character $_tide_left_items || tide_status_bg_color=$tide_status_bg_color_failure \ test "$tide_status_display" = 0 && contains character $_tide_left_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 tide_status_color=$tide_status_color_failure _tide_print_item status $tide_status_icon_failure' ' 1
else else
fish_status_to_signal $_tide_pipestatus | string replace SIG '' | string join '|' | read -l out fish_status_to_signal $_tide_pipestatus | string replace SIG '' | string join '|' | read -l out
@ -9,7 +9,7 @@ function _tide_item_status
tide_status_bg_color=$tide_status_bg_color_failure tide_status_color=$tide_status_color_failure \ tide_status_bg_color=$tide_status_bg_color_failure tide_status_color=$tide_status_color_failure \
_tide_print_item status $tide_status_icon_failure' ' $out _tide_print_item status $tide_status_icon_failure' ' $out
end end
else if not contains character $_tide_left_items else if test "$tide_status_display" = 2 || not contains character $_tide_left_items
_tide_print_item status $tide_status_icon _tide_print_item status $tide_status_icon
end end
end end

View File

@ -99,6 +99,7 @@ tide_status_bg_color 444444
tide_status_bg_color_failure 444444 tide_status_bg_color_failure 444444
tide_status_color $_tide_color_dark_green tide_status_color $_tide_color_dark_green
tide_status_color_failure D70000 tide_status_color_failure D70000
tide_status_display 0
tide_terraform_bg_color 444444 tide_terraform_bg_color 444444
tide_terraform_color 844FBA tide_terraform_color 844FBA
tide_time_bg_color 444444 tide_time_bg_color 444444

View File

@ -99,6 +99,7 @@ tide_status_bg_color normal
tide_status_bg_color_failure normal tide_status_bg_color_failure normal
tide_status_color $_tide_color_dark_green tide_status_color $_tide_color_dark_green
tide_status_color_failure D70000 tide_status_color_failure D70000
tide_status_display 0
tide_terraform_bg_color normal tide_terraform_bg_color normal
tide_terraform_color 844FBA tide_terraform_color 844FBA
tide_time_bg_color normal tide_time_bg_color normal

View File

@ -99,6 +99,7 @@ tide_status_bg_color 2E3436
tide_status_bg_color_failure CC0000 tide_status_bg_color_failure CC0000
tide_status_color 4E9A06 tide_status_color 4E9A06
tide_status_color_failure FFFF00 tide_status_color_failure FFFF00
tide_status_display 0
tide_terraform_bg_color 800080 tide_terraform_bg_color 800080
tide_terraform_color 000000 tide_terraform_color 000000
tide_time_bg_color D3D7CF tide_time_bg_color D3D7CF

View File

@ -9,6 +9,7 @@ end
set -lx tide_status_icon set -lx tide_status_icon
set -lx tide_status_icon_failure set -lx tide_status_icon_failure
set -lx tide_status_display 0
# Without character # Without character
set -lx _tide_left_items set -lx _tide_left_items
@ -58,3 +59,21 @@ _status # CHECK: ✔ 0|1
not false | true not false | true
_status # CHECK: ✘ 1|0 _status # CHECK: ✘ 1|0
# With display option to 1
set -lx tide_status_display 1
true
_status # CHECK:
false
_status # CHECK: ✘ 1
# With display option to 2
set -lx tide_status_display 2
true
_status # CHECK: ✔
false
_status # CHECK: ✘ 1