lib: Move _has_colors to log module
parent
5daecc9381
commit
8a3cf76307
|
|
@ -1,15 +1,5 @@
|
||||||
#!/usr/bin/env bash
|
#!/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
|
# colored ls
|
||||||
export LSCOLORS='Gxfxcxdxdxegedabagacad'
|
export LSCOLORS='Gxfxcxdxdxegedabagacad'
|
||||||
|
|
||||||
|
|
|
||||||
10
lib/log.bash
10
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_WARNING=2
|
||||||
export BASH_IT_LOG_LEVEL_ALL=3
|
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()
|
function _log_general()
|
||||||
{
|
{
|
||||||
_about 'Internal function used for logging, uses BASH_IT_LOG_PREFIX as a prefix'
|
_about 'Internal function used for logging, uses BASH_IT_LOG_PREFIX as a prefix'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue