To get oh-my-zsh
Append at the final of your
~/.zshrc
file the code bellow
function ocp_prompt_info() {
WILDCARD_DOMAIN=$(oc whoami --show-console 2> /dev/null | cut -d '.' -f2- | cut -d ':' -f1)
local result=''
if [ ! -z "$WILDCARD_DOMAIN" ]; then
CURRENT_PROJECT=$(oc project 2> /dev/null | cut -d '"' -f2)
result="%{$fg[magenta]%}[$WILDCARD_DOMAIN@$CURRENT_PROJECT]%{$fg[magenta]%} "
fi
echo "${result}"
}
#PROMPT+='$(ocp_prompt_info)'
RPROMPT+='$(ocp_prompt_info)'
After update the
~/.zshrc
file execute the command bellow to get the PS1 updated
exec zsh
- Step 4: Modify prompt without theme support
- Other projects related:
- https://www.freecodecamp.org/news/how-to-set-up-a-serious-kubernetes-terminal-dd07cab51cd4/
- https://berndonline.medium.com/how-to-display-openshift-kubernetes-namespace-on-bash-prompt-a068fe57d97c
- https://medium.com/@JorgeSantos7/changing-ps1-on-oh-my-zsh-aec231962002
- https://linuxhint.com/change-zsh-prompt-name/