chore: Fix shellcheck warnings

This commit is contained in:
Timo Reymann
2023-02-17 12:59:01 +01:00
parent 9fa16c8295
commit 619fcbc717
+11 -11
View File
@@ -19,16 +19,16 @@ _key_input() {
read -rsn1 a read -rsn1 a
# is the first character ESC? # is the first character ESC?
if [[ $ESC == $a ]]; then if [[ "$ESC" == "$a" ]]; then
read -rsn2 b read -rsn2 b
fi fi
local input="${a}${b}" local input="${a}${b}"
case $input in case "$input" in
$ESC[A) echo up ;; "$ESC[A") echo up ;;
$ESC[B) echo down ;; "$ESC[B") echo down ;;
$ESC[C) echo right ;; "$ESC[C") echo right ;;
$ESC[D) echo left ;; "$ESC[D") echo left ;;
'') echo enter ;; '') echo enter ;;
' ') echo space ;; ' ') echo space ;;
esac esac
@@ -98,7 +98,7 @@ confirm() {
echo -en "\033[36m\c " >&2 echo -en "\033[36m\c " >&2
local result="" local result=""
echo -n " " >&2 echo -n " " >&2
until [[ "$result" == "y" ]] || [[ "$result" == "N" ]] until [[ "$result" == "y" ]] || [[ "$result" == "n" ]] || [[ "$result" == "Y" ]] || [[ "$result" == "N" ]]
do do
echo -e "\033[1D\c " >&2 echo -e "\033[1D\c " >&2
# shellcheck disable=SC2162 # shellcheck disable=SC2162
@@ -106,9 +106,9 @@ confirm() {
done done
echo -en "\033[0m" >&2 echo -en "\033[0m" >&2
case $result in case "$result" in
y) echo -n 1; ;; y|Y) echo -n 1 ;;
N) echo -n 0 ;; n|N) echo -n 0 ;;
esac esac
echo "" >&2 echo "" >&2
@@ -213,7 +213,7 @@ checkbox() {
done done
if [ $idx -eq $selected ]; then if [ $idx -eq $selected ]; then
printf "%s \e[0m\e[36m\u276F\e[0m \e[36m%-50s\e[0m" "$icon" "$opt" >&2 printf "%s \e[0m\e[36m\e[0m \e[36m%-50s\e[0m" "$icon" "$opt" >&2
else else
printf "%s %-50s" "$icon" "$opt" >&2 printf "%s %-50s" "$icon" "$opt" >&2
fi fi