-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtctx-prompt.zsh
executable file
·28 lines (23 loc) · 963 Bytes
/
tctx-prompt.zsh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# Defines the tctx prompt
# Make your style changes here ;)
ZSH_TCTX_PROMPT_BACKGROUND="${ZSH_TCTX_PROMPT_BACKGROUND:-}"
ZSH_TCTX_PROMPT_PREFIX="${ZSH_TCTX_PROMPT_PREFIX:-tctx}"
ZSH_TCTX_PROMPT_PREFIX_FOREGROUND="${ZSH_TCTX_PROMPT_PREFIX_FOREGROUND:-255}"
ZSH_TCTX_PROMPT_PROD_FOREGROUND="${ZSH_TCTX_PROMPT_PROD_FOREGROUND:-009}"
ZSH_TCTX_PROMPT_DEFAULT_FOREGROUND="${ZSH_TCTX_PROMPT_DEFAULT_FOREGROUND:-005}"
function tctx_context_name {
tctx ls | grep active | cut -d " " -f1
}
function get_tctx_prompt {
local context_name=$(tctx_context_name)
if [[ -n "$context_name" ]]; then
local TCTX_PROMPT=''
TCTX_PREFIX="%{$FG[$ZSH_TCTX_PROMPT_PREFIX_FOREGROUND]%}$ZSH_TCTX_PROMPT_PREFIX"
if [[ "$context_name" == *"prod"* ]]; then
TCTX_PROMPT+="%{$FG[$ZSH_TCTX_PROMPT_PROD_FOREGROUND]%}$context_name"
else
TCTX_PROMPT="%{$FG[$ZSH_TCTX_PROMPT_DEFAULT_FOREGROUND]%}$context_name"
fi
echo "$TCTX_PREFIX $TCTX_PROMPT"
fi
}