Skip to content

Commit

Permalink
Set default color ouput to 'false' if output is not a terminal (#132)
Browse files Browse the repository at this point in the history
Co-authored-by: Josh Perry <[email protected]>
  • Loading branch information
joshperry and Josh Perry authored Sep 20, 2022
1 parent 195fdbe commit 424a154
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion kubetail
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,17 @@ calculate_default_namespace() {
echo "${KUBETAIL_NAMESPACE:-${config_namespace:-default}}"
}

# Sets default color ouput to 'false' if output is not a terminal
terminal_aware_default_color=line
[ ! -t 1 ] && terminal_aware_default_color=false

default_previous="${KUBETAIL_PREVIOUS:-false}"
default_since="${KUBETAIL_SINCE:-10s}"
default_namespace=$(calculate_default_namespace)
default_follow="${KUBETAIL_FOLLOW:-true}"
default_prefix="${KUBETAIL_PREFIX:-true}"
default_line_buffered="${KUBETAIL_LINE_BUFFERED:-}"
default_colored_output="${KUBETAIL_COLORED_OUTPUT:-line}"
default_colored_output="${KUBETAIL_COLORED_OUTPUT:-$terminal_aware_default_color}"
default_timestamps="${KUBETAIL_TIMESTAMPS:-}"
default_jq_selector="${KUBETAIL_JQ_SELECTOR:-}"
default_skip_colors="${KUBETAIL_SKIP_COLORS:-7,8}"
Expand Down

0 comments on commit 424a154

Please sign in to comment.