mirror of
https://github.com/oh-my-fish/theme-bobthefish.git
synced 2024-10-27 20:34:23 +00:00
Cleaner user/hostname display logic:
- Show if `theme_display_user` / `theme_display_hostname` is set to `yes`. - Show both user and hostname when using SSH. - Show user if `$default_user` is set and it isn't the current user.
This commit is contained in:
parent
4985cf8a4d
commit
b67c0bd910
@ -456,27 +456,34 @@ function __bobthefish_prompt_status -S -a last_status -d 'Display symbols for a
|
|||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_prompt_user -S -d 'Display actual user if different from $default_user in a prompt segment'
|
function __bobthefish_prompt_user -S -d 'Display actual user if different from $default_user in a prompt segment'
|
||||||
if [ "$theme_display_user" = 'yes' ]
|
[ "$theme_display_user" = 'yes' -o -n "$SSH_CLIENT" -o \( -n "$default_user" -a "$USER" != "$default_user" \) ]
|
||||||
if [ "$USER" != "$default_user" -o -n "$SSH_CLIENT" ]
|
and set -l display_user
|
||||||
__bobthefish_start_segment $__color_username
|
[ "$theme_display_hostname" = 'yes' -o -n "$SSH_CLIENT" ]
|
||||||
echo -ns (whoami)
|
and set -l display_hostname
|
||||||
|
|
||||||
|
if set -q display_user
|
||||||
|
__bobthefish_start_segment $__color_username
|
||||||
|
echo -ns (whoami)
|
||||||
|
end
|
||||||
|
|
||||||
|
if set -q display_hostname
|
||||||
|
set -l IFS .
|
||||||
|
hostname | read -l hostname __
|
||||||
|
if set -q display_user
|
||||||
|
# reset colors without starting a new segment...
|
||||||
|
# (so we can have a bold username and non-bold hostname)
|
||||||
|
set_color normal
|
||||||
|
set_color -b $__color_hostname[1] $__color_hostname[2..-1]
|
||||||
|
echo -ns '@' $hostname
|
||||||
|
else
|
||||||
|
__bobthefish_start_segment $__color_hostname
|
||||||
|
echo -ns $hostname
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if [ "$theme_display_hostname" = 'yes' ]
|
set -q display_user
|
||||||
set -l IFS .
|
or set -q displayed_hostname
|
||||||
hostname | read -l hostname __
|
and echo -ns ' '
|
||||||
if [ "$theme_display_user" = 'yes' ]
|
|
||||||
echo -ns '@' $hostname
|
|
||||||
else
|
|
||||||
__bobthefish_start_segment $__color_hostname
|
|
||||||
echo -ns $hostname
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if [ "$theme_display_user" = 'yes' -o "$theme_display_hostname" = 'yes' ]
|
|
||||||
echo -ns ' '
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function __bobthefish_prompt_hg -S -a current_dir -d 'Display the actual hg state'
|
function __bobthefish_prompt_hg -S -a current_dir -d 'Display the actual hg state'
|
||||||
|
Loading…
Reference in New Issue
Block a user