-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Only print colours when connected to a terminal #27
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
I signed it! |
CLAs look good, thanks! |
😃 thanks! You can achieve these stuff with kubectl directly. Just peek at kubectx/kubens source code. |
I very much appreciate that, and that's how I currently am doing/will continue to do in scripts regardless of whether or not Relying on a shell script that's not in my control for my personal scripts is not my intention here, I'd always opt to use |
This should be sufficient for your snippet
|
This is previously offered in #18, #22, and #27 and I previously rejected these PRs. My rationale was to prevent scripting around kubectx as it is meant to be used as an interactive tool. But clearly that will be a problem, when you're doing operations like: kubectx -d $(kubectx) which I proposed in #39. Plus this change is harmless. I think this implementation does a better check than the previous ones. Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This is useful when using
kubectx
orkubens
as part of a pipeline or when redirecting to a file and outputting colours' escape sequences is undesirable, i.e.