2019-02-28 06:19:09 +00:00
|
|
|
function __fish_print_pipestatus --description "Print pipestatus for prompt"
|
2019-03-05 18:19:57 +00:00
|
|
|
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]
|
2019-02-28 06:19:09 +00:00
|
|
|
set -e argv[1 2 3 4 5]
|
|
|
|
|
2019-12-10 21:32:35 +00:00
|
|
|
# only output status codes if some process in the pipe failed
|
2019-12-11 08:46:40 +00:00
|
|
|
# SIGPIPE (141 = 128 + 13) is usually not a failure, see #6375.
|
|
|
|
if string match -qvr '^(0|141)$' $argv
|
2019-03-05 18:19:57 +00:00
|
|
|
set -l sep (set_color normal){$brace_sep_color}{$separator}(set_color normal){$status_color}
|
2019-02-28 06:19:09 +00:00
|
|
|
set -l last_pipestatus_string (string join "$sep" (__fish_pipestatus_with_signal $argv))
|
2019-03-05 18:19:57 +00:00
|
|
|
printf "%s%s%s%s%s%s%s%s%s%s" (set_color normal )$brace_sep_color $left_brace \
|
2019-05-05 10:09:25 +00:00
|
|
|
(set_color normal) $status_color $last_pipestatus_string (set_color normal) \
|
|
|
|
$brace_sep_color $right_brace (set_color normal)
|
2019-02-28 06:19:09 +00:00
|
|
|
end
|
|
|
|
end
|