Add a function to check if the user is root.

Add a helper function to check if the user is root. This function can be
useful for the prompts for example. Modify the prompts made root checked
to use the function instead. Add also the support of Administrator like
a root user.

Fixes: #7031
This commit is contained in:
Daniel Bengtsson
2020-06-17 17:55:23 +02:00
committed by Fabian Homborg
parent de9e8cb897
commit e2f03fa8a7
11 changed files with 106 additions and 56 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 contains -- $USER root toor
if fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
end