Consistent y/n confirmation prompts

This commit is contained in:
3wc 2020-10-30 20:57:13 +02:00
parent a3cd6d2281
commit b226396764

25
abra
View File

@ -377,6 +377,15 @@ load_context() {
fi
}
prompt_confirm() {
read -rp "Continue? (y/[n])? " choice
case "$choice" in
y|Y ) return ;;
* ) exit;;
esac
}
#######################################
# abra app ..
#######################################
@ -506,13 +515,7 @@ sub_app_deploy (){
fi
echo " Stack: $(tput setaf 1)${STACK_NAME}$(tput sgr0)"
read -rp "Continue? (y/[n])? " choice
case "$choice" in
y|Y ) ;;
n|N ) return;;
* ) return;;
esac
prompt_confirm
(
cd "$APP_DIR" || error "\$APP_DIR '$APP_DIR' not found"
@ -535,7 +538,7 @@ sub_app_undeploy (){
load_instance_env
warning "Un-deploy $STACK_NAME from $SERVER?"
read -rp "Enter to continue, Ctrl+C to quit"
prompt_confirm
docker stack rm "$STACK_NAME"
}
@ -558,7 +561,7 @@ sub_app_delete (){
if [ "$abra___force" != "true" ]; then
warning "Delete $ENV_FILE?"
read -rp "Enter to continue, Ctrl+C to quit"
prompt_confirm
fi
rm "$ENV_FILE"
@ -604,8 +607,8 @@ sub_app_secret_rm(){
fi
if [ "$abra___force" != "true" ]; then
warning "Delete $(echo "$NAMES" | paste -d "")?"
read -rp "Enter to continue, Ctrl+C to quit"
warning "About to delete $(echo "$NAMES" | paste -d "")"
prompt_confirm
fi
for NAME in ${NAMES}; do