diff --git a/bin/combawa.sh b/bin/combawa.sh index 8dc81e3..5dd57d1 100755 --- a/bin/combawa.sh +++ b/bin/combawa.sh @@ -31,6 +31,7 @@ CONFIG_DIR="$COMBAWA_ROOT/config" COMBAWA_SCRIPTS_DIR="$COMBAWA_ROOT/scripts/combawa" # State variables. +_COMBAWA_BYPASS_CONFIRMATION=0 _COMBAWA_ONLY_PREDEPLOY=0 _COMBAWA_ONLY_POSTDEPLOY=0 _COMBAWA_NO_PREDEPLOY=0 @@ -101,6 +102,9 @@ do shift else case $key in + -y | --yes) + _COMBAWA_BYPASS_CONFIRMATION=1 + ;; -e | --env) case $2 in dev|testing|prod) @@ -243,6 +247,18 @@ else echo -e "$USAGE" fi +if [[ $_COMBAWA_BYPASS_CONFIRMATION == 0 ]]; then + ################################# + section_separator + ################################# + + message_step "Confirmation:" + read -p "Are you sure that you want to run this build [yN]? " -n 1 -r + if [[ ! $REPLY =~ ^[Yy]$ ]]; then + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 + fi +fi + ################################# section_separator ################################# diff --git a/utils/functions.sh b/utils/functions.sh index 93727cf..eb9bed9 100644 --- a/utils/functions.sh +++ b/utils/functions.sh @@ -91,6 +91,8 @@ usage() echo -e "${bold}\t--only-predeploy:${normal} Only process predeploy actions." echo -e "${bold}\t--only-postdeploy:${normal} Only process postdeploy actions." echo '' + echo -e "${bold}\t--yes, -y: Bypass confirmation step.${normal}" + echo '' echo -e "${bold}\t--backup, -b: Generates a backup before building the project.${normal}" echo -e '\t\tAllowed values are: 0: does not generate a backup, 1: generates a backup.' echo -e '\t\tDefault value: 1'