Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jovemfelix/1ea5cdafc6b1193cdf9c95f3fbabe611 to your computer and use it in GitHub Desktop.
Save jovemfelix/1ea5cdafc6b1193cdf9c95f3fbabe611 to your computer and use it in GitHub Desktop.

To get oh-my-zsh

Modify prompt without theme support

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

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment