This commit is contained in:
LinuxSquare 2024-03-01 13:53:14 +01:00
parent d4190b4144
commit aa3b81913d
2 changed files with 23 additions and 2 deletions

9
poddoc
View file

@ -24,6 +24,7 @@ operations:
$(basename ${0}) {-n --dryrun}
$(basename ${0}) {--noconfirm}
$(basename ${0}) {-p --pull}
$(basename ${0}) {-d --delete}
$(basename ${0}) {-i --inspect}
$(basename ${0}) {-s --start}
$(basename ${0}) {-x --stop}"
@ -41,8 +42,8 @@ the terms of the ${LICENSE}"
# SCRIPT START
##
OPT_SHORT="hVvnp:s:x:i:"
OPT_LONG="help,version,verbose,dryrun,noconfirm,pull:,start:,stop:,inspect:"
OPT_SHORT="hVvnp:d:s:x:i:"
OPT_LONG="help,version,verbose,dryrun,noconfirm,pull:,delete:,start:,stop:,inspect:"
TEMP=$(getopt -o ${OPT_SHORT} --long ${OPT_LONG} -n $(basename ${0}) -- "$@")
if [ "$?" != 0 ]; then
@ -75,6 +76,10 @@ while true; do
shift
pullpod "$1"
;;
-d|--delete)
shift
deletepod "$1"
;;
-s|--start)
shift
startpod "$1"

16
utils/delete Normal file
View file

@ -0,0 +1,16 @@
#!/usr/bin/env bash
##
# description: deletes the specified docker-compose.yml from local storage
# usage: deletepod <pod-name>
##
function deletepod() {
if [[ ! -d "$(getValueByKey 'PODMAN_DIRECTORY')/${1}" ]]; then
log e "$1 does not exist on local storage"
exit 1
fi
rm -rf "$(getValueByKey 'PODMAN_DIRECTORY')/${1}"
log s "${1} deleted"
exit 0
}