diff --git a/share/functions/__fish_print_pipestatus.fish b/share/functions/__fish_print_pipestatus.fish index bc8092076..89d1fc8e5 100644 --- a/share/functions/__fish_print_pipestatus.fish +++ b/share/functions/__fish_print_pipestatus.fish @@ -1,8 +1,7 @@ function __fish_print_pipestatus --description "Print pipestatus for prompt" - # take $status as optional argument to maintain compatibility set -l last_status - if set last_status (string match -r -- '^\d+$' $argv[1]) - set -e argv[1] + if set -q __fish_last_status + set last_status $__fish_last_status else set last_status $argv[-1] # default to $pipestatus[-1] end diff --git a/share/functions/fish_prompt.fish b/share/functions/fish_prompt.fish index c172084b2..553367c34 100644 --- a/share/functions/fish_prompt.fish +++ b/share/functions/fish_prompt.fish @@ -3,7 +3,7 @@ function fish_prompt --description 'Write out the prompt' set -l last_pipestatus $pipestatus - set -l last_status $status + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. set -l normal (set_color normal) # Color the prompt differently when we're root @@ -30,7 +30,7 @@ function fish_prompt --description 'Write out the prompt' set bold_flag end set __fish_prompt_status_generation $status_generation - set -l prompt_status (__fish_print_pipestatus $last_status "[" "]" "|" (set_color $fish_color_status) (set_color $bold_flag $fish_color_status) $last_pipestatus) + set -l prompt_status (__fish_print_pipestatus "[" "]" "|" (set_color $fish_color_status) (set_color $bold_flag $fish_color_status) $last_pipestatus) echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " " end diff --git a/share/tools/web_config/sample_prompts/classic_status.fish b/share/tools/web_config/sample_prompts/classic_status.fish index a0c699fa8..f916fb5dd 100644 --- a/share/tools/web_config/sample_prompts/classic_status.fish +++ b/share/tools/web_config/sample_prompts/classic_status.fish @@ -4,7 +4,7 @@ function fish_prompt --description "Write out the prompt" # Save our status set -l last_pipestatus $pipestatus - set -l last_status $status + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. set -l color_cwd set -l suffix @@ -23,6 +23,6 @@ function fish_prompt --description "Write out the prompt" end echo -n -s "$USER" @ (prompt_hostname) ' ' (set_color $color_cwd) (prompt_pwd) \ - " "(__fish_print_pipestatus $last_status "[" "]" "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus) \ + " "(__fish_print_pipestatus "[" "]" "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus) \ (set_color normal) "$suffix " end diff --git a/share/tools/web_config/sample_prompts/classic_vcs.fish b/share/tools/web_config/sample_prompts/classic_vcs.fish index c172084b2..553367c34 100644 --- a/share/tools/web_config/sample_prompts/classic_vcs.fish +++ b/share/tools/web_config/sample_prompts/classic_vcs.fish @@ -3,7 +3,7 @@ function fish_prompt --description 'Write out the prompt' set -l last_pipestatus $pipestatus - set -l last_status $status + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. set -l normal (set_color normal) # Color the prompt differently when we're root @@ -30,7 +30,7 @@ function fish_prompt --description 'Write out the prompt' set bold_flag end set __fish_prompt_status_generation $status_generation - set -l prompt_status (__fish_print_pipestatus $last_status "[" "]" "|" (set_color $fish_color_status) (set_color $bold_flag $fish_color_status) $last_pipestatus) + set -l prompt_status (__fish_print_pipestatus "[" "]" "|" (set_color $fish_color_status) (set_color $bold_flag $fish_color_status) $last_pipestatus) echo -n -s (set_color $fish_color_user) "$USER" $normal @ (set_color $color_host) (prompt_hostname) $normal ' ' (set_color $color_cwd) (prompt_pwd) $normal (fish_vcs_prompt) $normal " "$prompt_status $suffix " " end diff --git a/share/tools/web_config/sample_prompts/informative.fish b/share/tools/web_config/sample_prompts/informative.fish index cec7c3c99..8d608b013 100644 --- a/share/tools/web_config/sample_prompts/informative.fish +++ b/share/tools/web_config/sample_prompts/informative.fish @@ -4,7 +4,7 @@ function fish_prompt --description 'Informative prompt' #Save the return status of the previous command set -l last_pipestatus $pipestatus - set -l last_status $status + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. if functions -q fish_is_root_user; and fish_is_root_user printf '%s@%s %s%s%s# ' $USER (prompt_hostname) (set -q fish_color_cwd_root @@ -12,7 +12,7 @@ function fish_prompt --description 'Informative prompt' or set_color $fish_color_cwd) \ (prompt_pwd) (set_color normal) else - set -l pipestatus_string (__fish_print_pipestatus $last_status "[" "] " "|" (set_color $fish_color_status) \ + set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) \ (set_color --bold $fish_color_status) $last_pipestatus) printf '[%s] %s%s@%s %s%s %s%s%s \f\r> ' (date "+%H:%M:%S") (set_color brblue) \ diff --git a/share/tools/web_config/sample_prompts/informative_vcs.fish b/share/tools/web_config/sample_prompts/informative_vcs.fish index 1b66c14b8..0df4008d2 100644 --- a/share/tools/web_config/sample_prompts/informative_vcs.fish +++ b/share/tools/web_config/sample_prompts/informative_vcs.fish @@ -3,7 +3,7 @@ function fish_prompt --description 'Write out the prompt' set -l last_pipestatus $pipestatus - set -l last_status $status + set -lx __fish_last_status $status # Export for __fish_print_pipestatus. if not set -q __fish_git_prompt_show_informative_status set -g __fish_git_prompt_show_informative_status 1 @@ -78,7 +78,7 @@ function fish_prompt --description 'Write out the prompt' printf '%s ' (fish_vcs_prompt) - set -l pipestatus_string (__fish_print_pipestatus $last_status "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus) + set -l pipestatus_string (__fish_print_pipestatus "[" "] " "|" (set_color $fish_color_status) (set_color --bold $fish_color_status) $last_pipestatus) echo -n $pipestatus_string set_color normal