fork/fish-shell
git clone https://git.julia.blue/fork/fish-shell
867946468
master
1# localization: skip(private) 2function __fish_print_pipestatus --description"Print pipestatus for prompt" 3set -l last_status 4if set -q __fish_last_status 5set last_status$__fish_last_status 6else 7set last_status$argv [ -1 ] # default to $pipestatus[-1] 8end 9set -l left_brace$argv [ 1 ] 10set -l right_brace$argv [ 2 ] 11set -l separator$argv [ 3 ] 12set -l brace_sep_color$argv [ 4 ] 13set -l status_color$argv [ 5 ] 14 15set -e argv[ 1 2 3 4 5 ] 16 17if not set -q argv[ 1 ] 18echo error: missing argument>&2 19status print-stack-trace>&2 20return 1 21end 22 23# Only print status codes if the job failed. 24# SIGPIPE (141 = 128 + 13) is usually not a failure, see #6375. 25if not contains $last_status 0 141 26set -l sep$brace_sep_color$separator$status_color 27set -l last_pipestatus_string( fish_status_to_signal $argv | string join" $sep " ) 28set -l last_status_string"" 29if test " $last_status " -ne " $argv [ -1 ] " 30set last_status_string" " $status_color$last_status 31end 32set -l normal( set_color --reset) 33# The "normal"s are to reset modifiers like bold - see #7771. 34printf "%s" $normal $brace_sep_color $left_brace \ 35$status_color $last_pipestatus_string \ 36$normal $brace_sep_color $right_brace $normal $last_status_string $normal 37end 38end