From 0f6bdaa60238e15832bcbe0414b5d62d3fe55669 Mon Sep 17 00:00:00 2001 From: Patrice-Gaudicheau Date: Sat, 24 Feb 2024 09:02:18 +0100 Subject: [PATCH] feat: implemented user confirmation for safe removal of containers and volumes in Makefile --- Makefile | 4 +++- confirm_remove.sh | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100755 confirm_remove.sh diff --git a/Makefile b/Makefile index 265a608a..cbcc41d9 100644 --- a/Makefile +++ b/Makefile @@ -2,7 +2,9 @@ install: @docker-compose up -d remove: - @docker-compose down -v + @chmod +x confirm_remove.sh + @./confirm_remove.sh + start: @docker-compose start diff --git a/confirm_remove.sh b/confirm_remove.sh new file mode 100755 index 00000000..729c2507 --- /dev/null +++ b/confirm_remove.sh @@ -0,0 +1,8 @@ +#!/bin/bash +echo "Warning: This will remove all containers and volumes, including persistent data. Do you want to continue? [Y/N]" +read ans +if [ "$ans" == "Y" ] || [ "$ans" == "y" ]; then + docker-compose down -v +else + echo "Operation cancelled." +fi