Closed cdenneen closed 6 years ago
TERM=vt100
~ » export TERM=vt100
~ » kubectx
~ » kubens
~ » export TERM=xterm
~ » kubectx
aws
docker-for-desktop
k8s
~ » kubens
default
jenkins
kube-public
kube-system
For non-color terminals add * to current context?
we discussed this previously and it's not a great idea. we want commands like kubectx -d $(kubectx)
to work. if you want to see the current-context in your PS1 string, try out kube-ps1.
Add option to only print current context
again we discussed this many times in #14, #28, #51. you can either use https://github.com/jonmosco/kube-ps1 or kubectl config current-context
. No need a kubectx
feature for this.
Sorry, I'll reopen this to keep track of NO_COLOR
empty output issue.
(This is regarding your report about empty output when TERM=vt100.)
It looks like the tput
command we're calling to set the colors is failing when TERM=vt100. I asked about it here:
https://unix.stackexchange.com/questions/464028/why-is-tput-failing-silently-on-term-vt100 would be interesting to learn why.
In the meanwhile, instead of doing
yellow=$(tput setaf 3)
we can do:
yellow=$(tput setaf 3 || true)
to ignore errors, but I don't think this is a good idea, since VT-100 has color support.
I just fixed this by ignoring tput failure. vt100 does not have colors, so this will just print black and white output.
I'm not convinced people still use vt100 :)
Currently if using something like no color or vt100 terminal you won't see what the current context is... if the terminal supports color it will be bold and a color.
~ » export TERM=vt100 ~ » kubectx aws docker-for-desktop k8s
~ » export TERM=xterm ~ » kubectx aws docker-for-desktop k8s
kubectx -- k8s