From 89724f936691a32bbda07649f4d0a50c1d98d791 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sat, 5 Sep 2020 09:02:32 +0200 Subject: [PATCH] prompts: guard against missing fish_is_root_user Prevents error spew when running one of these prompt on fish 3.1.2. --- share/functions/fish_prompt.fish | 2 +- share/tools/web_config/sample_prompts/classic.fish | 2 +- share/tools/web_config/sample_prompts/classic_status.fish | 2 +- share/tools/web_config/sample_prompts/classic_vcs.fish | 2 +- share/tools/web_config/sample_prompts/debian_chroot.fish | 2 +- share/tools/web_config/sample_prompts/informative.fish | 2 +- share/tools/web_config/sample_prompts/informative_vcs.fish | 2 +- share/tools/web_config/sample_prompts/nim.fish | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/share/functions/fish_prompt.fish b/share/functions/fish_prompt.fish index edbbf1d27..c172084b2 100644 --- a/share/functions/fish_prompt.fish +++ b/share/functions/fish_prompt.fish @@ -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 diff --git a/share/tools/web_config/sample_prompts/classic.fish b/share/tools/web_config/sample_prompts/classic.fish index b4d5887c6..3f371e323 100644 --- a/share/tools/web_config/sample_prompts/classic.fish +++ b/share/tools/web_config/sample_prompts/classic.fish @@ -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 diff --git a/share/tools/web_config/sample_prompts/classic_status.fish b/share/tools/web_config/sample_prompts/classic_status.fish index 585a5e9dc..a0c699fa8 100644 --- a/share/tools/web_config/sample_prompts/classic_status.fish +++ b/share/tools/web_config/sample_prompts/classic_status.fish @@ -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 diff --git a/share/tools/web_config/sample_prompts/classic_vcs.fish b/share/tools/web_config/sample_prompts/classic_vcs.fish index edbbf1d27..c172084b2 100644 --- a/share/tools/web_config/sample_prompts/classic_vcs.fish +++ b/share/tools/web_config/sample_prompts/classic_vcs.fish @@ -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 diff --git a/share/tools/web_config/sample_prompts/debian_chroot.fish b/share/tools/web_config/sample_prompts/debian_chroot.fish index 38bd46618..2f9ed514e 100644 --- a/share/tools/web_config/sample_prompts/debian_chroot.fish +++ b/share/tools/web_config/sample_prompts/debian_chroot.fish @@ -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) \ diff --git a/share/tools/web_config/sample_prompts/informative.fish b/share/tools/web_config/sample_prompts/informative.fish index 02c7296ce..cec7c3c99 100644 --- a/share/tools/web_config/sample_prompts/informative.fish +++ b/share/tools/web_config/sample_prompts/informative.fish @@ -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) \ diff --git a/share/tools/web_config/sample_prompts/informative_vcs.fish b/share/tools/web_config/sample_prompts/informative_vcs.fish index 62fac6eb8..1b66c14b8 100644 --- a/share/tools/web_config/sample_prompts/informative_vcs.fish +++ b/share/tools/web_config/sample_prompts/informative_vcs.fish @@ -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 diff --git a/share/tools/web_config/sample_prompts/nim.fish b/share/tools/web_config/sample_prompts/nim.fish index 6034bb41f..8d73c1529 100644 --- a/share/tools/web_config/sample_prompts/nim.fish +++ b/share/tools/web_config/sample_prompts/nim.fish @@ -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