mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Revert "use global variables for $pipestatus
in prompts to allow users to customize the look"
This reverts commit d5c18350a7
.
This commit is contained in:
parent
da2925bad7
commit
d71e39f756
1 changed files with 11 additions and 27 deletions
|
@ -1,35 +1,19 @@
|
|||
function __fish_print_pipestatus --description "Print pipestatus for prompt"
|
||||
|
||||
# allow users to customize these variables
|
||||
if not set -q __fish_prompt_pipestatus_left_brace
|
||||
set -g __fish_prompt_pipestatus_left_brace $argv[1]
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_pipestatus_right_brace
|
||||
set -g __fish_prompt_pipestatus_right_brace $argv[2]
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_pipestatus_separator
|
||||
set -g __fish_prompt_pipestatus_separator $argv[3]
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_pipestatus_brace_sep_color
|
||||
set -g __fish_prompt_pipestatus_brace_sep_color $argv[4]
|
||||
end
|
||||
|
||||
if not set -q __fish_prompt_pipestatus_color
|
||||
set -g __fish_prompt_pipestatus_color $argv[5]
|
||||
end
|
||||
|
||||
# maybe these could be in global variables similar to __fish_color_status to allow
|
||||
# users to set the variables to modify the braces/separator/color used
|
||||
set -l left_brace $argv[1]
|
||||
set -l right_brace $argv[2]
|
||||
set -l separator $argv[3]
|
||||
set -l brace_sep_color $argv[4]
|
||||
set -l status_color $argv[5]
|
||||
set -e argv[1 2 3 4 5]
|
||||
|
||||
# only output $pipestatus if there was a pipe and any part of it had non-zero exit status
|
||||
if set -q argv[2] && string match -qvr '^0$' $argv
|
||||
set -l sep (set_color normal){$__fish_prompt_pipestatus_brace_sep_color}{$__fish_prompt_pipestatus_separator}(set_color normal){$__fish_prompt_pipestatus_color}
|
||||
set -l sep (set_color normal){$brace_sep_color}{$separator}(set_color normal){$status_color}
|
||||
set -l last_pipestatus_string (string join "$sep" (__fish_pipestatus_with_signal $argv))
|
||||
printf "%s%s%s%s%s%s%s%s%s%s" (set_color normal) $__fish_prompt_pipestatus_brace_sep_color \
|
||||
$__fish_prompt_pipestatus_left_brace (set_color normal) $__fish_prompt_pipestatus_color \
|
||||
$last_pipestatus_string (set_color normal) $__fish_prompt_pipestatus_brace_sep_color \
|
||||
$__fish_prompt_pipestatus_right_brace (set_color normal)
|
||||
printf "%s%s%s%s%s%s%s%s%s%s" (set_color normal )$brace_sep_color $left_brace \
|
||||
(set_color normal) $status_color $last_pipestatus_string (set_color normal) \
|
||||
$brace_sep_color $right_brace (set_color normal)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue