mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
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:
parent
4331face4a
commit
89724f9366
8 changed files with 8 additions and 8 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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) \
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue