refact(scorphish): colorize prompt arrows according to exit code

parent 239f8dd0
...@@ -55,6 +55,8 @@ function _git_dirty_remotes -a remote_color -a ahead_color ...@@ -55,6 +55,8 @@ function _git_dirty_remotes -a remote_color -a ahead_color
end end
function fish_prompt function fish_prompt
set -l exit_code $status
set_color -o 666 set_color -o 666
printf '[' printf '['
set_color -o blue set_color -o blue
...@@ -72,9 +74,9 @@ function fish_prompt ...@@ -72,9 +74,9 @@ function fish_prompt
set_color -o 666 set_color -o 666
if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE
printf "]" printf ']'
else else
printf "]\n" printf ']\n'
end end
set -l gray (set_color 666) set -l gray (set_color 666)
...@@ -100,18 +102,24 @@ function fish_prompt ...@@ -100,18 +102,24 @@ function fish_prompt
end end
end end
set_color 060 if test $exit_code -ne 0
set arrow_colors 600 900 c00 f00
else
set arrow_colors 060 090 0c0 0f0
end
if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE if set -q SCORPHISH_GIT_INFO_ON_FIRST_LINE
printf "\n»" printf '\n'
else else
printf " »" printf ' '
end end
set_color 090
printf '»' for arrow_color in $arrow_colors
set_color 0c0 set_color $arrow_color
printf '»' printf '»'
set_color 0f0 end
printf '» '
printf ' '
set_color normal set_color normal
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment