From 378b5d7295a1a42fa09fbfcd7df52c8f9338d700 Mon Sep 17 00:00:00 2001 From: zabereer Date: Tue, 26 Feb 2019 18:06:36 +0000 Subject: [PATCH] update classic_status.fish prompt to include $pipestatus --- .../web_config/sample_prompts/classic_status.fish | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/share/tools/web_config/sample_prompts/classic_status.fish b/share/tools/web_config/sample_prompts/classic_status.fish index 4023a717c..c117ab501 100644 --- a/share/tools/web_config/sample_prompts/classic_status.fish +++ b/share/tools/web_config/sample_prompts/classic_status.fish @@ -3,10 +3,23 @@ function fish_prompt --description "Write out the prompt" # Save our status + set -l last_pipestatus $pipestatus set -l last_status $status + # only output $pipestatus if there was a pipe and any part of it had non-zero exit status + # TODO maybe have a common function that returns true if all array elements match a certain value? + if test (count $last_pipestatus) -gt 1 + for pstat in $last_pipestatus + if test $pstat -ne 0 + set -l last_pipestatus_string (string join "|" (__fish_pipestatus_with_signal $last_pipestatus)) + printf "%s[%s]%s " (set_color yellow --bold) $last_pipestatus_string (set_color normal) + break + end + end + end + if test $last_status -ne 0 - printf "%s(%d)%s " (set_color red --bold) $last_status (set_color normal) + printf "%s(%s)%s " (set_color red --bold) (__fish_status_to_signal $last_status) (set_color normal) end set -l color_cwd