mirror of
https://github.com/IlanCosman/tide.git
synced 2024-09-11 17:15:34 +03:00
Add tide_context_hostname_parts
This commit is contained in:
parent
10b74059ad
commit
b508a7f52b
@ -1,9 +1,15 @@
|
||||
function _tide_item_context
|
||||
if set -q SSH_TTY
|
||||
tide_context_color=$tide_context_color_ssh _tide_print_item context $USER@$hostname
|
||||
set -lx tide_context_color $tide_context_color_ssh
|
||||
test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER ||
|
||||
h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts])
|
||||
else if test "$EUID" = 0
|
||||
tide_context_color=$tide_context_color_root _tide_print_item context $USER@$hostname
|
||||
set -lx tide_context_color $tide_context_color_root
|
||||
test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER ||
|
||||
h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts])
|
||||
else if test "$tide_context_always_display" = true
|
||||
tide_context_color=$tide_context_color_default _tide_print_item context $USER@$hostname
|
||||
set -lx tide_context_color $tide_context_color_default
|
||||
test "$tide_context_hostname_parts" = 0 && _tide_print_item context $USER ||
|
||||
h=(string split . $hostname) _tide_print_item context $USER@(string join . $h[..$tide_context_hostname_parts])
|
||||
end
|
||||
end
|
||||
|
@ -20,6 +20,7 @@ tide_context_bg_color 444444
|
||||
tide_context_color_default D7AF87
|
||||
tide_context_color_root $_tide_color_gold
|
||||
tide_context_color_ssh D7AF87
|
||||
tide_context_hostname_parts 1
|
||||
tide_crystal_bg_color 444444
|
||||
tide_crystal_color FFFFFF
|
||||
tide_crystal_icon ⬢
|
||||
|
@ -20,6 +20,7 @@ tide_context_bg_color normal
|
||||
tide_context_color_default D7AF87
|
||||
tide_context_color_root $_tide_color_gold
|
||||
tide_context_color_ssh D7AF87
|
||||
tide_context_hostname_parts 1
|
||||
tide_crystal_bg_color normal
|
||||
tide_crystal_color FFFFFF
|
||||
tide_crystal_icon ⬢
|
||||
|
@ -20,6 +20,7 @@ tide_context_bg_color 444444
|
||||
tide_context_color_default D7AF87
|
||||
tide_context_color_root $_tide_color_gold
|
||||
tide_context_color_ssh D7AF87
|
||||
tide_context_hostname_parts 1
|
||||
tide_crystal_bg_color FFFFFF
|
||||
tide_crystal_color 000000
|
||||
tide_crystal_icon ⬢
|
||||
|
@ -5,14 +5,19 @@ function _context
|
||||
_tide_decolor (_tide_item_context)
|
||||
end
|
||||
|
||||
set -lx tide_context_hostname_parts 5
|
||||
|
||||
set -lx tide_context_always_display false
|
||||
_context # Check:
|
||||
|
||||
set -lx tide_context_always_display true
|
||||
_context # CHECK: {{.*@.*}}
|
||||
_context # CHECK: {{[^@]*@[^@]*}}
|
||||
|
||||
set -g SSH_TTY /dev/pts/0
|
||||
_context # CHECK: {{.*@.*}}
|
||||
_context # CHECK: {{[^@]*@[^@]*}}
|
||||
|
||||
set EUID 0
|
||||
_context # CHECK: {{.*@.*}}
|
||||
_context # CHECK: {{[^@]*@[^@]*}}
|
||||
|
||||
set -lx tide_context_hostname_parts 0
|
||||
_context # CHECK: {{[^@]*}}
|
||||
|
Loading…
Reference in New Issue
Block a user