mirror of
https://github.com/ahmetb/kubectx.git
synced 2025-06-27 15:56:49 +00:00
Merge pull request #41 from ahmetb/tty_check
Do not print colors if stdout isn't tty
This commit is contained in:
commit
d1b69a995a
2
kubectx
2
kubectx
@ -59,7 +59,7 @@ list_contexts() {
|
|||||||
normal=$(tput sgr0)
|
normal=$(tput sgr0)
|
||||||
|
|
||||||
for c in $(get_contexts); do
|
for c in $(get_contexts); do
|
||||||
if [[ "${c}" = "${cur}" ]]; then
|
if [[ -t 1 && "${c}" = "${cur}" ]]; then
|
||||||
echo "${darkbg}${yellow}${c}${normal}"
|
echo "${darkbg}${yellow}${c}${normal}"
|
||||||
else
|
else
|
||||||
echo "${c}"
|
echo "${c}"
|
||||||
|
2
kubens
2
kubens
@ -113,7 +113,7 @@ list_namespaces() {
|
|||||||
cur="$(current_namespace)"
|
cur="$(current_namespace)"
|
||||||
ns_list=$(get_namespaces)
|
ns_list=$(get_namespaces)
|
||||||
for c in $ns_list; do
|
for c in $ns_list; do
|
||||||
if [[ "${c}" = "${cur}" ]]; then
|
if [[ -t 1 && "${c}" = "${cur}" ]]; then
|
||||||
echo "${darkbg}${yellow}${c}${normal}"
|
echo "${darkbg}${yellow}${c}${normal}"
|
||||||
else
|
else
|
||||||
echo "${c}"
|
echo "${c}"
|
||||||
|
Loading…
Reference in New Issue
Block a user