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

8
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)"
@ -153,7 +155,7 @@ __detect(){
gunzip) __dynamic_detect--version "${command}" ;;
tee) __dynamic_detect--version "${command}" ;;
screen) __dynamic_detect-v "${command}" ;;
# Container runtimes
docker|podman) __dynamic_detect--version "${command}" ;;
@ -177,7 +179,7 @@ __detect(){
npm|yarn) __dynamic_detect--version "${command}" ;;
## Rust
rustc|cargo) __dynamic_detect--version "${command}" ;;
rustc|cargo) __dynamic_detect--version "${command}" ;;
## Cloud Tools
aws|eb|sls|gcloud) __dynamic_detect--version "${command}" ;;