Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(status): add tide_status_display #500

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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