mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-10 14:24:39 +03:00
Add status item
This commit is contained in:
parent
ad5f0e0e32
commit
e68ee51173
@ -1,6 +1,7 @@
|
||||
# Created by lean_wizard
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l lastExitCode $status
|
||||
set -g last_pipestatus $pipestatus
|
||||
set -g last_status $status
|
||||
|
||||
echo
|
||||
|
||||
@ -16,7 +17,7 @@ function fish_prompt --description 'Write out the prompt'
|
||||
echo -e (lean_right_prompt)
|
||||
|
||||
# Prompt character
|
||||
if test $lastExitCode -eq 0
|
||||
if test $last_status -eq 0
|
||||
set_color $lean_color_green
|
||||
else
|
||||
set_color $fish_color_error
|
||||
@ -27,7 +28,7 @@ end
|
||||
|
||||
function _lean_right_prompt_nocolor
|
||||
echo -n " "
|
||||
|
||||
|
||||
for item in lean_{$lean_right_prompt_items}
|
||||
if test -n "$$item"
|
||||
echo -n "$$item"
|
||||
@ -36,4 +37,3 @@ function _lean_right_prompt_nocolor
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
@ -4,6 +4,23 @@ function lean_load_right_prompt_items
|
||||
end
|
||||
end
|
||||
|
||||
function _lean_status
|
||||
if string match -q --invert "0" $last_pipestatus
|
||||
set -l fishPipestatusWithSignal (__fish_pipestatus_with_signal $last_pipestatus)
|
||||
|
||||
if test (count $last_pipestatus) -gt 1 || string match -qe "SIG" $fishPipestatusWithSignal
|
||||
if test $last_status -eq 0
|
||||
set -g lean_status_color $lean_status_success_color
|
||||
echo -n "$lean_status_success_icon "
|
||||
else
|
||||
set -g lean_status_color $lean_status_failure_color
|
||||
echo -n "$lean_status_failure_icon "
|
||||
end
|
||||
string join "|" (string replace "SIG" "" $fishPipestatusWithSignal)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function _lean_timer
|
||||
if test (math $CMD_DURATION/1000) -gt $lean_timer_duration
|
||||
echo -n (math --scale=$lean_timer_decimals $CMD_DURATION/1000)"s"
|
||||
|
@ -35,6 +35,8 @@ function lean_uninstall
|
||||
|
||||
# ----------------Right Prompt Items----------------
|
||||
set -a rmVars lean_right_prompt_items
|
||||
# --------------Status--------------
|
||||
set -a rmVars lean_status_{success_icon, success_color, failure_icon, failure_color}
|
||||
# --------------Timer--------------
|
||||
set -a rmVars lean_timer_{color, decimals, duration}
|
||||
# ---------------SSH---------------
|
||||
|
17
install.fish
17
install.fish
@ -28,7 +28,7 @@ function lean_install
|
||||
set -U lean_color_gold D7AF00
|
||||
# ---------------Pwd---------------
|
||||
set -U lean_pwd_shorten_margin 5
|
||||
set -U lean_pwd_unwritable_icon # Lock
|
||||
set -U lean_pwd_unwritable_icon "" # Lock
|
||||
# ------------Git prompt------------
|
||||
set -U __fish_git_prompt_show_informative_status true
|
||||
set -U __fish_git_prompt_showstashstate true
|
||||
@ -38,8 +38,8 @@ function lean_install
|
||||
set -U __fish_git_prompt_char_upstream_ahead " ⇡"
|
||||
set -U __fish_git_prompt_char_upstream_behind " ⇣"
|
||||
set -U __fish_git_prompt_char_stagedstate " +"
|
||||
set -U __fish_git_prompt_char_dirtystate ' !'
|
||||
set -U __fish_git_prompt_char_untrackedfiles ' ?'
|
||||
set -U __fish_git_prompt_char_dirtystate " !"
|
||||
set -U __fish_git_prompt_char_untrackedfiles " ?"
|
||||
set -U __fish_git_prompt_char_stashstate " *"
|
||||
# --------Colors--------
|
||||
set -U __fish_git_prompt_color_branch $lean_color_green
|
||||
@ -50,7 +50,12 @@ function lean_install
|
||||
set -U __fish_git_prompt_color_stashstate $lean_color_green
|
||||
|
||||
# ----------------Right Prompt Items----------------
|
||||
set -U lean_right_prompt_items timer context jobs
|
||||
set -U lean_right_prompt_items "status" "timer" "context" "jobs"
|
||||
# --------------Status--------------
|
||||
set -U lean_status_success_icon "✔"
|
||||
set -U lean_status_success_color 5FAF00
|
||||
set -U lean_status_failure_icon "✘"
|
||||
set -U lean_status_failure_color D70000
|
||||
# --------------Timer--------------
|
||||
set -U lean_timer_color 87875F
|
||||
set -U lean_timer_decimals 0
|
||||
@ -59,7 +64,7 @@ function lean_install
|
||||
set -U lean_context_ssh_color D7AF87
|
||||
set -U lean_context_root_color D7AF00
|
||||
# ---------------Jobs---------------
|
||||
set -U lean_jobs_icon # Gear
|
||||
set -U lean_jobs_icon "" # Gear
|
||||
set -U lean_jobs_color 5FAF00
|
||||
|
||||
# -----------------------Finish-----------------------
|
||||
@ -85,7 +90,7 @@ function _user_confirm_defaultYes -a question
|
||||
return 0
|
||||
case n N no No
|
||||
return 1
|
||||
case ''
|
||||
case ""
|
||||
return 0
|
||||
end
|
||||
end
|
||||
|
@ -1,2 +1,4 @@
|
||||
# Created by lean_wizard
|
||||
function fake_prompt --description 'Write out the prompt'
|
||||
set -l lastExitCode $status
|
||||
set -g last_pipestatus $pipestatus
|
||||
set -g last_status $status
|
@ -1,5 +1,5 @@
|
||||
# Prompt character
|
||||
if test $lastExitCode -eq 0
|
||||
if test $last_status -eq 0
|
||||
set_color $lean_color_green
|
||||
else
|
||||
set_color $fish_color_error
|
||||
|
@ -1,3 +1,4 @@
|
||||
# Created by lean_wizard
|
||||
function fish_prompt --description 'Write out the prompt'
|
||||
set -l lastExitCode $status
|
||||
set -g last_pipestatus $pipestatus
|
||||
set -g last_status $status
|
@ -1,5 +1,5 @@
|
||||
# Prompt character
|
||||
if test $lastExitCode -eq 0
|
||||
if test $last_status -eq 0
|
||||
set_color $lean_color_green
|
||||
else
|
||||
set_color $fish_color_error
|
||||
|
Loading…
Reference in New Issue
Block a user