Respect $NO_COLOR

Fixes #54.

Signed-off-by: Ahmet Alp Balkan <ahmetb@google.com>
This commit is contained in:
Ahmet Alp Balkan 2018-06-10 14:15:44 -07:00
parent 428fb0045c
commit c606382a62
No known key found for this signature in database
GPG Key ID: F84A66B2CBC29F60
2 changed files with 2 additions and 2 deletions

View File

@ -63,7 +63,7 @@ list_contexts() {
cur_ctx_bg=${KUBECTX_CURRENT_BGCOLOR:-$darkbg}
for c in $(get_contexts); do
if [[ -t 1 && "${c}" = "${cur}" ]]; then
if [[ -t 1 && -z "${NO_COLOR:-}" && "${c}" = "${cur}" ]]; then
echo "${cur_ctx_bg}${cur_ctx_fg}${c}${normal}"
else
echo "${c}"

2
kubens
View File

@ -117,7 +117,7 @@ list_namespaces() {
cur="$(current_namespace)"
ns_list=$(get_namespaces)
for c in $ns_list; do
if [[ -t 1 && "${c}" = "${cur}" ]]; then
if [[ -t 1 && -z "${NO_COLOR:-}" && "${c}" = "${cur}" ]]; then
echo "${cur_ctx_bg}${cur_ctx_fg}${c}${normal}"
else
echo "${c}"