mirror of
https://github.com/IlanCosman/tide.git
synced 2024-11-26 09:42:51 +03:00
Minor edits
This commit is contained in:
parent
e0bf7eca1a
commit
9f11d9fa6b
@ -1,5 +1,5 @@
|
||||
function _tide_item_character
|
||||
if test $_tide_last_status = 0
|
||||
if test $_tide_status = 0
|
||||
set_color $tide_character_color
|
||||
else
|
||||
set_color $tide_character_color_failure
|
||||
|
@ -43,8 +43,8 @@ function _tide_item_git
|
||||
# Git status/stash
|
||||
test "$inside_git_dir" = true && set -l _set_dir_opt -C $git_dir/..
|
||||
# Suppress errors in case we are in a bare repo
|
||||
set -l git_info (git $_set_dir_opt --no-optional-locks status --porcelain 2>/dev/null)
|
||||
string match -qr '(0|(?<stash>.*))\n(0|(?<conflicted>.*))\n(0|(?<staged>.*))\n(0|(?<dirty>.*))\n(0|(?<untracked>.*))' \
|
||||
git_info=(git $_set_dir_opt --no-optional-locks status --porcelain 2>/dev/null) \
|
||||
string match -qr '(0|(?<stash>.*))\n(0|(?<conflicted>.*))\n(0|(?<staged>.*))\n(0|(?<dirty>.*))\n(0|(?<untracked>.*))' \
|
||||
"$(git $_set_dir_opt stash list 2>/dev/null | count
|
||||
string match --regex '^UU' $git_info | count
|
||||
string match --regex '^[ADMR].' $git_info | count
|
||||
|
@ -1,18 +1,15 @@
|
||||
function _tide_item_status
|
||||
# Variables are exported as strings, convert _tide_last_pipestatus back into a list
|
||||
set -l _tide_last_pipestatus (string split ' ' $_tide_last_pipestatus)
|
||||
|
||||
if string match --quiet --invert 0 $_tide_last_pipestatus # If there is a failure anywhere in the pipestatus
|
||||
if test "$_tide_last_pipestatus" = 1 # If simple failure
|
||||
if string match --quiet --invert 0 $_tide_pipestatus # If there is a failure anywhere in the pipestatus
|
||||
if test "$_tide_pipestatus" = 1 # If simple failure
|
||||
contains character $tide_left_prompt_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 if test $_tide_last_status = 0
|
||||
else if test $_tide_status = 0
|
||||
_tide_print_item status $tide_status_icon' ' \
|
||||
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
|
||||
(fish_status_to_signal $_tide_pipestatus | string replace SIG '' | string join '|')
|
||||
else
|
||||
tide_status_bg_color=$tide_status_bg_color_failure tide_status_color=$tide_status_color_failure \
|
||||
_tide_print_item status $tide_status_icon_failure' ' \
|
||||
(fish_status_to_signal $_tide_last_pipestatus | string replace SIG '' | string join '|')
|
||||
(fish_status_to_signal $_tide_pipestatus | string replace SIG '' | string join '|')
|
||||
end
|
||||
else if not contains character $tide_left_prompt_items
|
||||
_tide_print_item status $tide_status_icon
|
||||
|
@ -17,9 +17,10 @@ function _tide_refresh_prompt --on-variable $_tide_prompt_var
|
||||
end
|
||||
|
||||
function fish_prompt
|
||||
_tide_last_status=$status _tide_last_pipestatus=$pipestatus if not set -e _tide_self_repainting
|
||||
_tide_status=$status _tide_pipestatus=$pipestatus if not set -e _tide_self_repainting
|
||||
jobs --query
|
||||
fish --command "_tide_jobs_status=$status CMD_DURATION=$CMD_DURATION COLUMNS=$COLUMNS \
|
||||
fish --command "set _tide_pipestatus $_tide_pipestatus
|
||||
_tide_jobs_status=$status CMD_DURATION=$CMD_DURATION COLUMNS=$COLUMNS \
|
||||
fish_bind_mode=$fish_bind_mode set $_tide_prompt_var (_tide_prompt)" &
|
||||
builtin disown
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
# RUN: %fish %s
|
||||
|
||||
function _status
|
||||
set -lx _tide_last_status $status
|
||||
set -lx _tide_last_pipestatus $pipestatus
|
||||
set -lx _tide_status $status
|
||||
set -lx _tide_pipestatus $pipestatus
|
||||
_tide_decolor (_tide_item_status)
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user