From d71e39f7562e3b5a9f925b9486dae3bc33058e78 Mon Sep 17 00:00:00 2001 From: zabereer Date: Tue, 5 Mar 2019 18:19:57 +0000 Subject: [PATCH] Revert "use global variables for `$pipestatus` in prompts to allow users to customize the look" This reverts commit d5c18350a76d514b3c56cb9a683e30e2f5fe6f19. --- share/functions/__fish_print_pipestatus.fish | 38 ++++++-------------- 1 file changed, 11 insertions(+), 27 deletions(-) diff --git a/share/functions/__fish_print_pipestatus.fish b/share/functions/__fish_print_pipestatus.fish index ecd0ec989..6851d7791 100644 --- a/share/functions/__fish_print_pipestatus.fish +++ b/share/functions/__fish_print_pipestatus.fish @@ -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