Support detecting stdout, Fix #58 (#66)

This commit is contained in:
wzy 2023-07-28 22:11:40 +08:00 committed by GitHub
parent c12a38bbdd
commit 8b43040ce2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 3 deletions

4
has
View File

@ -10,7 +10,9 @@ readonly BINARY_NAME="has"
readonly VERSION="v1.6.0"
## constants - symbols for success failure
if [[ -z $TERM ]]; then
if [[ ! -t 1 ]]; then
TERM="dumb"
elif [[ -z $TERM ]]; then
TERM="xterm"
fi
readonly txtreset="$(tput -T $TERM sgr0)"