Skip to content

Commit

Permalink
Add tide_status_display
Browse files Browse the repository at this point in the history
  • Loading branch information
chapa committed Apr 1, 2024
1 parent 44c521a commit 8faea68
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions functions/_tide_item_status.fish
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
function _tide_item_status
if string match -qv 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus
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
else
fish_status_to_signal $_tide_pipestatus | string replace SIG '' | string join '|' | read -l out
test $_tide_status = 0 && _tide_print_item status $tide_status_icon' ' $out ||
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
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
end
end
1 change: 1 addition & 0 deletions functions/tide/configure/configs/classic.fish
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ tide_status_bg_color 444444
tide_status_bg_color_failure 444444
tide_status_color $_tide_color_dark_green
tide_status_color_failure D70000
tide_status_display 0
tide_terraform_bg_color 444444
tide_terraform_color 844FBA
tide_time_bg_color 444444
Expand Down
1 change: 1 addition & 0 deletions functions/tide/configure/configs/lean.fish
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ tide_status_bg_color normal
tide_status_bg_color_failure normal
tide_status_color $_tide_color_dark_green
tide_status_color_failure D70000
tide_status_display 0
tide_terraform_bg_color normal
tide_terraform_color 844FBA
tide_time_bg_color normal
Expand Down
1 change: 1 addition & 0 deletions functions/tide/configure/configs/rainbow.fish
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ tide_status_bg_color 2E3436
tide_status_bg_color_failure CC0000
tide_status_color 4E9A06
tide_status_color_failure FFFF00
tide_status_display 0
tide_terraform_bg_color 800080
tide_terraform_color 000000
tide_time_bg_color D3D7CF
Expand Down
19 changes: 19 additions & 0 deletions tests/_tide_item_status.test.fish
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ end

set -lx tide_status_icon βœ”
set -lx tide_status_icon_failure ✘
set -lx tide_status_display 0

# Without character
set -lx _tide_left_items
Expand Down Expand Up @@ -58,3 +59,21 @@ _status # CHECK: βœ” 0|1

not false | true
_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

0 comments on commit 8faea68

Please sign in to comment.