Files
scwrypts/zsh/scwrypts/environment/delete
yage 4baacd9c32 v3.2.0
=====================================================================

--- Changes ------------------------------

- split up environment files per scwrypts group

- updated i3/launch-or-show to provide some new options

--- Bug Fixes ----------------------------

- utils/io commands like 'STATUS' no longer throw errors '%' characters

- fixed ERROR_CHECK function calls to CHECK_ERRORS
2023-06-27 16:35:30 -06:00

37 lines
843 B
Bash
Executable File

#!/bin/zsh
DEPENDENCIES+=()
REQUIRED_ENV+=()
use scwrypts/environment-files
CHECK_ENVIRONMENT
#####################################################################
PROMPT 'choose an environment to delete'
ENV_NAME=$(SCWRYPTS__SELECT_ENV)
[ ! $ENV_NAME ] && ABORT
ENV_FILES=($(SCWRYPTS__GET_ENV_FILES $ENV_NAME))
STATUS "preparing to remove '$ENV_NAME'"
WARNING "
the '$ENV_NAME' environment will be removed configured options
and stored credentials will be lost forever:
$(echo $ENV_FILES | sed 's| /|\n - /|g; s/^/ - /')
"
yN 'continue?' || ABORT
STATUS "removing environment"
for ENV_FILE in ${ENV_FILES[@]}
do
rm "$ENV_FILE" \
&& SUCCESS "removed '$ENV_FILE'" \
|| ERROR "unable to remove '$ENV_FILE'; is it protected?" \
;
done
CHECK_ERRORS -n || FAIL 2 "some errors ocurred when cleaning up $ENV_NAME"