jonmosco / kube-ps1

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

the KUBE_PS1* configuration env vars dominate tab completion #165

Closed jinyius closed 2 months ago

jinyius commented 1 year ago

(using zsh)

KUBE_PS1_BG_COLOR            KUBE_PS1_DIVIDER             KUBE_PS1_NS_ENABLE           KUBE_PS1_SYMBOL_DEFAULT      kubectx
KUBE_PS1_BINARY              KUBE_PS1_KUBECONFIG_CACHE    KUBE_PS1_PREFIX              KUBE_PS1_SYMBOL_ENABLE       kubens
KUBE_PS1_CLUSTER_FUNCTION    KUBE_PS1_LAST_TIME           KUBE_PS1_SEPARATOR           KUBE_PS1_SYMBOL_USE_IMG      kubeoff
KUBE_PS1_CONTEXT             KUBE_PS1_NAMESPACE           KUBE_PS1_SHELL               kube_ps1                     kubeon
KUBE_PS1_CTX_COLOR           KUBE_PS1_NAMESPACE_FUNCTION  KUBE_PS1_SUFFIX              kubectl                      
KUBE_PS1_DISABLE_PATH        KUBE_PS1_NS_COLOR            KUBE_PS1_SYMBOL_COLOR        kubectl-ssh

it would be nice not to export the KUBE_PS1 vars everywhere. some ideas:

  1. prefix them with underscore
  2. make the arguments to the kube_ps1 function
  3. read from a config file
jonmosco commented 1 year ago

I cleaned up a good amount of these in the latest release, and more to come to cut this list down by at least half.

KUBE_PS1_BG_COLOR            KUBE_PS1_CONTEXT_ENABLE      KUBE_PS1_NAMESPACE_FUNCTION  KUBE_PS1_SEPARATOR           KUBE_PS1_SYMBOL_OC_IMG
KUBE_PS1_BINARY              KUBE_PS1_CTX_COLOR           KUBE_PS1_NS_COLOR            KUBE_PS1_SUFFIX              KUBE_PS1_SYMBOL_PADDING
KUBE_PS1_CLUSTER_FUNCTION    KUBE_PS1_DIVIDER             KUBE_PS1_NS_ENABLE           KUBE_PS1_SYMBOL_COLOR        KUBE_PS1_SYMBOL_USE_IMG
KUBE_PS1_CONTEXT             KUBE_PS1_NAMESPACE           KUBE_PS1_PREFIX              KUBE_PS1_SYMBOL_ENABLE
jinyius commented 1 year ago

since it's a function, you can probably use command like args for some values. also, could use a config file, but this seems overweight.

thanks for looking at this.

(a super-cheap workaround would be to underscore prefix these settings)

jonmosco commented 1 year ago

Yes, that is also in the TODO and being worked on.

jonmosco commented 2 months ago

Going to close this out. Newest commit has cut back on the amt of env vars. Thank you for raising this issue!