From e45f1cff76ae5b6000c4efd35d6dc759359c4b3f Mon Sep 17 00:00:00 2001 From: Robert Reed Date: Sun, 22 Aug 2021 17:22:30 -0700 Subject: feat: uninstall all docker artifacts --- dactyl.sh | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/dactyl.sh b/dactyl.sh index bf6259c..c0bc41e 100755 --- a/dactyl.sh +++ b/dactyl.sh @@ -9,8 +9,10 @@ set -e container="" shellContainer=DM-shell -configContainer=DM-config modelContainer=DM-model +configContainer=DM-config +containers=("$shellContainer" "$configContainer" "$modelContainer") + imageName=dactyl-keyboard srcBind="$(pwd)/src:/app/src" thingsBind="$(pwd)/things:/app/things" @@ -289,11 +291,15 @@ function handleRebuildImage() { buildImage } +function removeImage() { + inform "Removing docker image: $imageName..." + docker image rm $imageName +} + function handleRemoveImage() { warn "This will remove docker image: $imageName" confirmContinue "Would you like to continue?" - inform "Removing docker image: $imageName..." - docker image rm $imageName + removeImage } function handleInspectImage() { @@ -550,6 +556,20 @@ function promptStartShellSession() { startShellSession } +################################ +# Uninstaller +################################ + +function handleUninstall() { + for currentContainer in "${containers[@]}"; do + container="$currentContainer" + removeContainer + done + + removeImage + exit +} + ################################ # Main Menu Logic ################################ -- cgit v1.2.3