Merge pull request #41 from ahmetb/tty_check

Do not print colors if stdout isn't tty
This commit is contained in:
Ahmet Alp Balkan 2018-04-17 13:17:10 -07:00 committed by GitHub
commit d1b69a995a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -59,7 +59,7 @@ list_contexts() {
normal=$(tput sgr0)
for c in $(get_contexts); do
if [[ "${c}" = "${cur}" ]]; then
if [[ -t 1 && "${c}" = "${cur}" ]]; then
echo "${darkbg}${yellow}${c}${normal}"
else
echo "${c}"

2
kubens
View File

@ -113,7 +113,7 @@ list_namespaces() {
cur="$(current_namespace)"
ns_list=$(get_namespaces)
for c in $ns_list; do
if [[ "${c}" = "${cur}" ]]; then
if [[ -t 1 && "${c}" = "${cur}" ]]; then
echo "${darkbg}${yellow}${c}${normal}"
else
echo "${c}"