prompts: guard against missing fish_is_root_user

Prevents error spew when running one of these prompt on fish 3.1.2.
This commit is contained in:
Johannes Altmanninger 2020-09-05 09:02:32 +02:00
parent 4331face4a
commit 89724f9366
8 changed files with 8 additions and 8 deletions

View file

@ -9,7 +9,7 @@ function fish_prompt --description 'Write out the prompt'
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd
set -l suffix '>'
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
end

View file

@ -3,7 +3,7 @@ function fish_prompt --description "Write out the prompt"
set -l color_cwd
set -l suffix
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else

View file

@ -9,7 +9,7 @@ function fish_prompt --description "Write out the prompt"
set -l color_cwd
set -l suffix
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else

View file

@ -9,7 +9,7 @@ function fish_prompt --description 'Write out the prompt'
# Color the prompt differently when we're root
set -l color_cwd $fish_color_cwd
set -l suffix '>'
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
end

View file

@ -21,7 +21,7 @@ function fish_prompt --description 'Write out the prompt, prepending the Debian
echo -n -s (set_color yellow) "$__fish_debian_chroot_prompt" (set_color normal) ' '
end
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
echo -n -s "$USER" @ (prompt_hostname) ' ' (set -q fish_color_cwd_root
and set_color $fish_color_cwd_root
or set_color $fish_color_cwd) (prompt_pwd) \

View file

@ -6,7 +6,7 @@ function fish_prompt --description 'Informative prompt'
set -l last_pipestatus $pipestatus
set -l last_status $status
if fish_is_root_user
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
and set_color $fish_color_cwd_root
or set_color $fish_color_cwd) \

View file

@ -59,7 +59,7 @@ function fish_prompt --description 'Write out the prompt'
set -l color_cwd
set -l suffix
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else

View file

@ -54,7 +54,7 @@ function fish_prompt
set_color -o green
echo -n [
if fish_is_root_user
if functions -q fish_is_root_user; and fish_is_root_user
set_color -o red
else
set_color -o yellow