From 8a3cf763074309647fa4f5615af2c5a54fedbb19 Mon Sep 17 00:00:00 2001 From: Noah Gorny Date: Sat, 27 Jun 2020 14:01:47 +0300 Subject: [PATCH] lib: Move _has_colors to log module --- lib/appearance.bash | 10 ---------- lib/log.bash | 10 ++++++++++ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/appearance.bash b/lib/appearance.bash index d684332f..6d0ef2ff 100644 --- a/lib/appearance.bash +++ b/lib/appearance.bash @@ -1,15 +1,5 @@ #!/usr/bin/env bash -function _has_colors() -{ - # Check that stdout is a terminal - test -t 1 || return 1 - - ncolors=$(tput colors) - test -n "$ncolors" && test "$ncolors" -ge 8 || return 1 - return 0 -} - # colored ls export LSCOLORS='Gxfxcxdxdxegedabagacad' diff --git a/lib/log.bash b/lib/log.bash index afc6b1ac..856ec9aa 100644 --- a/lib/log.bash +++ b/lib/log.bash @@ -4,6 +4,16 @@ export BASH_IT_LOG_LEVEL_ERROR=1 export BASH_IT_LOG_LEVEL_WARNING=2 export BASH_IT_LOG_LEVEL_ALL=3 +function _has_colors() +{ + # Check that stdout is a terminal + test -t 1 || return 1 + + ncolors=$(tput colors) + test -n "$ncolors" && test "$ncolors" -ge 8 || return 1 + return 0 +} + function _log_general() { _about 'Internal function used for logging, uses BASH_IT_LOG_PREFIX as a prefix'