jonmosco / kube-ps1

Kubernetes prompt info for bash and zsh
Apache License 2.0
3.52k stars 351 forks source link

multiple prompts #176

Closed kenhen93Evolve closed 1 year ago

kenhen93Evolve commented 1 year ago

Hello,

I installed kube-ps1 on my mac using brew

I am using iterm2 with multiple tabs and my prompt shows multiple prompts

(⎈|arn:aws:eks:us-west-2:cluster:default)(⎈|arn:aws:eks:us-west-2:cluster:default)(⎈|arn:aws:eks:us-west-2:cluster:default)(⎈|arn:aws:eks:us-west-2:cluster:default)(⎈|arn:aws:eks:us-west-2:cluster:default)(⎈|arn:aws:eks:us-west-2:cluster:default)

my .zshrc looks like

[[ $PROMPT_COMMAND =~ _kube_ps1_update_cache ]] || PROMPT_COMMAND="_kube_ps1_update_cache;${PROMPT_COMMAND:-:}"

function get_cluster_short() {
  echo "$1" | cut -d / -f1
}

KUBE_PS1_CLUSTER_FUNCTION=get_cluster_short

source "/opt/homebrew/opt/kube-ps1/share/kube-ps1.sh"
PS1='$(kube_ps1)'$PS1

What am I doing wrong?

kenhen93Evolve commented 1 year ago

Seems like this happen if I source my .zshrc multiple times as I tinker with the setting. If I open a new tab it is ok.

jonmosco commented 1 year ago

Can't read the .zshrc file clearly, can you make it a code block?

kenhen93Evolve commented 1 year ago

Sorry, just updated the first post

jonmosco commented 1 year ago

Not sure why you are setting the $PROMPT_COMMAND external of sourcing kube-ps1? Try removing/commenting that out and reload your session.

kenhen93Evolve commented 1 year ago

I got that from another one of your support posts.

jonmosco commented 1 year ago

Ok. If you remove it, does that fix your issue?

kenhen93Evolve commented 1 year ago

The issue is not happening anymore