mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 05:13:10 +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"
|
function __fish_print_pipestatus --description "Print pipestatus for prompt"
|
||||||
|
# maybe these could be in global variables similar to __fish_color_status to allow
|
||||||
# allow users to customize these variables
|
# users to set the variables to modify the braces/separator/color used
|
||||||
if not set -q __fish_prompt_pipestatus_left_brace
|
set -l left_brace $argv[1]
|
||||||
set -g __fish_prompt_pipestatus_left_brace $argv[1]
|
set -l right_brace $argv[2]
|
||||||
end
|
set -l separator $argv[3]
|
||||||
|
set -l brace_sep_color $argv[4]
|
||||||
if not set -q __fish_prompt_pipestatus_right_brace
|
set -l status_color $argv[5]
|
||||||
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
|
|
||||||
|
|
||||||
set -e argv[1 2 3 4 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
|
# 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
|
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))
|
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 \
|
printf "%s%s%s%s%s%s%s%s%s%s" (set_color normal )$brace_sep_color $left_brace \
|
||||||
$__fish_prompt_pipestatus_left_brace (set_color normal) $__fish_prompt_pipestatus_color \
|
(set_color normal) $status_color $last_pipestatus_string (set_color normal) \
|
||||||
$last_pipestatus_string (set_color normal) $__fish_prompt_pipestatus_brace_sep_color \
|
$brace_sep_color $right_brace (set_color normal)
|
||||||
$__fish_prompt_pipestatus_right_brace (set_color normal)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue