This commit is contained in:
Arkoprabho Chakraborti 2023-08-24 06:51:40 +00:00 committed by GitHub
commit b5ab5a00eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 15 deletions

35
has
View File

@ -15,16 +15,22 @@ if [[ ! -t 1 ]]; then
elif [[ -z $TERM ]]; then
TERM="xterm"
fi
readonly txtreset="$(tput -T $TERM sgr0)"
readonly txtbold="$(tput -T $TERM bold)"
readonly txtblack="$(tput -T $TERM setaf 0)"
readonly txtred="$(tput -T $TERM setaf 1)"
readonly txtgreen="$(tput -T $TERM setaf 2)"
readonly txtyellow="$(tput -T $TERM setaf 3)"
readonly txtblue="$(tput -T $TERM setaf 4)"
readonly txtpurple="$(tput -T $TERM setaf 5)"
readonly txtcyan="$(tput -T $TERM setaf 6)"
readonly txtwhite="$(tput -T $TERM setaf 7)"
txtreset="$(tput -T "$TERM" sgr0)"
readonly txtreset
txtbold="$(tput -T "$TERM" bold)"
readonly txtbold
txtred="$(tput -T "$TERM" setaf 1)"
readonly txtred
txtgreen="$(tput -T "$TERM" setaf 2)"
readonly txtgreen
txtyellow="$(tput -T "$TERM" setaf 3)"
readonly txtyellow
# unicode "✗"
readonly fancyx='\342\234\227'
# unicode "✓"
@ -38,7 +44,7 @@ readonly FAIL="${txtbold}${txtred}${fancyx}${txtreset}"
COLOR_AUTO="auto"
COLOR_NEVER="never"
COLOR_ALWAYS="always"
COLOR_OPTS=(${COLOR_AUTO} ${COLOR_NEVER} ${COLOR_ALWAYS})
COLOR_OPTS=("${COLOR_AUTO} ${COLOR_NEVER} ${COLOR_ALWAYS}")
COLOR="${COLOR_AUTO}"
COLOR_PREFIX="--color"
@ -335,7 +341,6 @@ OUTPUT=/dev/stdout
while getopts ":qhv-" OPTION; do
case "$OPTION" in
q)
QUIET="true"
OUTPUT=/dev/null
;;
h)
@ -347,10 +352,10 @@ while getopts ":qhv-" OPTION; do
exit 0
;;
-)
[ $OPTIND -ge 1 ] && optind=$(expr $OPTIND - 1) || optind=$OPTIND
[ $OPTIND -ge 1 ] && optind=$((OPTIND - 1)) || optind=$OPTIND
eval OPTION="\$$optind"
OPTARG=$(echo $OPTION | cut -d'=' -f2)
OPTION=$(echo $OPTION | cut -d'=' -f1)
OPTARG=$(echo "$OPTION" | cut -d'=' -f2)
OPTION=$(echo "$OPTION" | cut -d'=' -f1)
case $OPTION in
--version)
_version