diff --git a/lib/helpers.sh b/lib/helpers.sh index c1eabcb..27e35c6 100755 --- a/lib/helpers.sh +++ b/lib/helpers.sh @@ -153,13 +153,13 @@ export -f check_default_version; function cleanup() { log 'info' 'Performing cleanup'; local pwd="$(pwd)"; - + # Safety check to ensure TFENV_CONFIG_DIR is set and not empty if [ -z "${TFENV_CONFIG_DIR:-""}" ]; then log 'error' 'TFENV_CONFIG_DIR is not set, cannot perform cleanup safely'; return 1; fi; - + log 'debug' "Deleting ${TFENV_CONFIG_DIR}/version"; rm -rf "${TFENV_CONFIG_DIR}/version"; log 'debug' "Deleting ${TFENV_CONFIG_DIR}/version.prev"; @@ -200,6 +200,10 @@ function check_dependencies() { log 'error' 'GNU Grep is a requirement and your Mac does not have it. Consider "brew install grep" or "nix profile install nixpkgs#gnugrep"'; fi; + + if ! command -v unzip >/dev/null 2>&1; then + log 'error' 'unzip is a requirement and your device does not have it. Install unzip using your preferred method.'; + fi; }; export -f check_dependencies;