Add "; or echo" to every command substitution set_color

This commit is contained in:
Ilan Cosman 2020-09-05 14:48:27 -07:00
parent cbb127777a
commit 24df67cd51
10 changed files with 25 additions and 21 deletions

View File

@ -3,7 +3,7 @@ function _tide_git_prompt_set_vars --on-variable tide_git_prompt_bg_color
case '' 'normal'
set color ''
case '*'
set color (set_color -b $tide_git_prompt_bg_color)
set color (set_color -b $tide_git_prompt_bg_color; or echo)
end
for var in (set --names | string match --regex "__fish_git_prompt_char_.*")

View File

@ -49,7 +49,7 @@ function _tide_left_prompt
set_color -b $color
if test "$tide_left_prompt_pad_items" = 'true' -a "$item" != 'prompt_char'
printf '%s' " $output"(set_color -b $color)' ' # The set_color is for git_prompt which resets the background color
printf '%s' " $output"(set_color -b $color; or echo)' ' # The set_color is for git_prompt which resets the background color
else
printf '%s' "$output"
end

View File

@ -23,7 +23,11 @@ function _tide_pwd --on-variable PWD --on-signal WINCH
set -a tidePwdAnchors (string split -r -m1 '/' "$_tide_git_dir")[2]
end
set -l colorDirs (set_color $tide_pwd_color_dirs)
set -l colorDirs (set_color $tide_pwd_color_dirs; or echo)
set -l colorAnchors (set_color -o $tide_pwd_color_anchors; or echo)
set -l keepBackgroundColor (set_color normal -b $tide_pwd_bg_color; or echo)
set -l colorTruncatedDirs (set_color $tide_pwd_color_truncated_dirs; or echo)
set -g _tide_pwd_output $colorDirs$pwd
# Prepend icons
@ -39,7 +43,7 @@ function _tide_pwd --on-variable PWD --on-signal WINCH
for dir in $splitPwd
if contains $dir $tidePwdAnchors
set _tide_pwd_output (string replace $dir (set_color -o $tide_pwd_color_anchors)$dir(set_color normal -b $tide_pwd_bg_color) $_tide_pwd_output)
set _tide_pwd_output (string replace $dir $colorAnchors$dir$keepBackgroundColor $_tide_pwd_output)
else if test (string length $pwd) -gt $pwdMaxLength
set -l dirTruncated $dir
set -l truncationLength 1
@ -50,7 +54,7 @@ function _tide_pwd --on-variable PWD --on-signal WINCH
set -a truncatedList $dirTruncated
set pwd (string replace $dir $dirTruncated $pwd)
set _tide_pwd_output (string replace $dir (set_color $tide_pwd_color_truncated_dirs)$dirTruncated $_tide_pwd_output)
set _tide_pwd_output (string replace $dir $colorTruncatedDirs$dirTruncated $_tide_pwd_output)
end
end

View File

@ -7,7 +7,7 @@ function _tide_right_prompt
# In this section we check if each line exist, if so add the frame to it. If not, insert a line containing only the frame
# and update printAtEndedRightPromptHeight
set -l frameColor (set_color $tide_right_prompt_frame_color -b normal)
set -l frameColor (set_color $tide_right_prompt_frame_color -b normal; or echo)
set splitText[1] $splitText[1]$frameColor'─╮'
@ -90,7 +90,7 @@ function _tide_fetch_right_prompt_items
set_color -b $color
if test "$tide_right_prompt_pad_items" = 'true'
printf '%s' ' '$output(set_color -b $color)' ' # The set_color is for git_prompt which resets the background color
printf '%s' ' '$output(set_color -b $color; or echo)' ' # The set_color is for git_prompt which resets the background color
else
printf '%s' "$output"
end

View File

@ -31,8 +31,8 @@ function _next_choice -a nextChoice
end
function _tide_menu
set -l bold (set_color -o)
set -l norm (set_color normal)
set -l bold (set_color -o; or echo)
set -l norm (set_color normal; or echo)
set -l listWithSlashes (string join '/' $_tide_option_list)

View File

@ -15,8 +15,8 @@ function _tide_sub_test
end
if not functions -q fishtape
set -l b (set_color -o)
set -l n (set_color normal)
set -l b (set_color -o; or echo)
set -l n (set_color normal; or echo)
printf '%s\n' $b'fishtape'$n' must be installed to to run Tide\'s test suite. You can install it with'$b' tide test -i'$n
return
end
@ -73,9 +73,9 @@ function _tide_sub_test
end
function _tide_test_help
set -l b (set_color -o)
set -l n (set_color normal)
set -l bl (set_color $_tide_color_light_blue)
set -l b (set_color -o; or echo)
set -l n (set_color normal; or echo)
set -l bl (set_color $_tide_color_light_blue; or echo)
set -l optionList \
'-v or --verbose' \

View File

@ -21,9 +21,9 @@ function tide
end
function _tide_help
set -l b (set_color -o)
set -l n (set_color normal)
set -l bl (set_color $_tide_color_light_blue)
set -l b (set_color -o; or echo)
set -l n (set_color normal; or echo)
set -l bl (set_color $_tide_color_light_blue; or echo)
set -l options \
'-v or --version' \

View File

@ -46,7 +46,7 @@ function _fake_tide_left_prompt
set_color -b $color
if test "$fake_tide_left_prompt_pad_items" = 'true' -a "$item" != 'prompt_char'
printf '%s' " $output"(set_color -b $color)' ' # The set_color is for git_prompt which resets the background color
printf '%s' " $output"(set_color -b $color; or echo)' ' # The set_color is for git_prompt which resets the background color
else
printf '%s' "$output"
end

View File

@ -7,7 +7,7 @@ function _fake_tide_right_prompt
# In this section we check if each line exist, if so add the frame to it. If not, insert a line containing only the frame
# and update printAtEndedRightPromptHeight
set -l frameColor (set_color $fake_tide_right_prompt_frame_color -b normal)
set -l frameColor (set_color $fake_tide_right_prompt_frame_color -b normal; or echo)
set splitText[1] $splitText[1]$frameColor'─╮'
@ -79,7 +79,7 @@ function _tide_fetch_right_prompt_items
set_color -b $color
if test "$fake_tide_right_prompt_pad_items" = 'true'
printf '%s' ' '$output(set_color -b $color)' ' # The set_color is for git_prompt which resets the background color
printf '%s' ' '$output(set_color -b $color; or echo)' ' # The set_color is for git_prompt which resets the background color
else
printf '%s' "$output"
end

View File

@ -3,7 +3,7 @@
set -lx decolorText 'Hello Foo'
function _decolor -a color
_tide_decolor (set_color $color)$decolorText
_tide_decolor (set_color $color; or echo)$decolorText
end
@test 'Color' (_decolor red) = $decolorText