add default answer and add compliance with shellcheck

This commit is contained in:
Simon Vieille 2019-07-31 20:49:59 +02:00
parent faeb8492b7
commit 4398347162
Signed by: deblan
GPG key ID: 03383D15A1D31745
3 changed files with 6 additions and 4 deletions

View file

@ -99,7 +99,7 @@ chmod 600 "$TMP_FILE"
whiptail --textbox "$TMP_FILE" 25 80 whiptail --textbox "$TMP_FILE" 25 80
rm "$TMP_FILE" rm "$TMP_FILE"
CONTINUE="$(form_yes_no -t "$TITLE" -l "Do you confirm?")" CONTINUE="$(form_yes_no -t "$TITLE" -l "Do you confirm?" -n)"
if [ "$CONTINUE" = "no" ]; then if [ "$CONTINUE" = "no" ]; then
printf "Aborded!\\n" printf "Aborded!\\n"

View file

@ -5,13 +5,15 @@ LABEL=
ERROR=0 ERROR=0
HEIGHT=8 HEIGHT=8
WIDTH=50 WIDTH=50
PARAMS=
while getopts "t:l:d:h:w:r" option; do while getopts "t:l:d:h:w:rn" option; do
case "$option" in case "$option" in
l) LABEL="$OPTARG";; l) LABEL="$OPTARG";;
t) TITLE="$OPTARG";; t) TITLE="$OPTARG";;
h) HEIGHT="$OPTARG";; h) HEIGHT="$OPTARG";;
w) WIDTH="$OPTARG";; w) WIDTH="$OPTARG";;
n) PARAMS="$PARAMS --defaultno";;
:) ERROR=1;; :) ERROR=1;;
?) ERROR=1;; ?) ERROR=1;;
esac esac
@ -21,7 +23,7 @@ if [ $ERROR -eq 1 ]; then
exit 1 exit 1
fi fi
if (whiptail --title "$TITLE" --yesno "$LABEL" $HEIGHT $WIDTH 3>&1 1>&2 2>&3) then if (whiptail --title "$TITLE" --yesno "$LABEL" $PARAMS $HEIGHT $WIDTH 3>&1 1>&2 2>&3) then
printf "yes" printf "yes"
else else
printf "no" printf "no"

View file

@ -2,4 +2,4 @@
. ./etc/config . ./etc/config
$PHP_BIN -dvariables_order=EGPCS ./share/bin/twigc -E -d ./src/templates/ < "src/templates/${1}.twig" "$PHP_BIN" -dvariables_order=EGPCS ./share/bin/twigc -E -d ./src/templates/ < "src/templates/${1}.twig"