mirror of https://github.com/kdabir/has.git
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>
This commit is contained in:
parent
a2d7c083c7
commit
61032d63f1
35
has
35
has
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue