Compare commits

...

3 Commits

Author SHA1 Message Date
Christian Clauss f399e1bd82
Merge f0e6f43221 into 61032d63f1 2023-08-28 15:15:55 +02:00
Christian Clauss f0e6f43221 Turn off GitHub Actions fail-fast
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstrategyfail-fast
2023-08-28 15:15:49 +02:00
Arkoprabho Chakraborti 61032d63f1
Fixes shellcheck warnings (#75)
* MODIFY: Declare and assign separately to avoid masking return values

For Shellcheck SC2155

* DELETE: Unused variables

* MODIFY: Double quote to prevent globbing and word splitting

Addresses SC2086

* DELETE: Remove unused variable

Addresses SC2034

* MODIFY: Remove use of expr

Addresses SC2003 and SC2004

* Remove spaces around COLOR options

Thanks to @cclaus
https://github.com/kdabir/has/pull/75#discussion_r1301313069

Co-authored-by: Christian Clauss <cclauss@me.com>

---------

Co-authored-by: Christian Clauss <cclauss@me.com>
2023-08-28 14:04:58 +05:30
2 changed files with 22 additions and 15 deletions

View File

@ -17,6 +17,7 @@ jobs:
name: test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- debian # uses debian:buster-20200327-slim which is debian 10.3
@ -36,6 +37,7 @@ jobs:
name: test_all
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
container:
- ubuntu # uses ubuntu:bionic-20200311 which is ubuntu 18.04

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