#!/usr/bin/env zsh
#####################################################################

MAIN() {
	local LOGFILE_COUNT="$(find "${SCWRYPTS_LOG_PATH}" -type f 2>/dev/null | wc -l)"

	[ "${SCWRYPTS_LOG_PATH}" ] && [ -d "${SCWRYPTS_LOG_PATH}" ] && [[ ${LOGFILE_COUNT} -gt 0 ]] || {
		echo.success "no local logs found; nothing to do!"
		return 0
	}

	echo.status "found ${LOGFILE_COUNT} log files"
	echo.warning "this will permanently delete everything in\n${SCWRYPTS_LOG_PATH}"

	user.yN 'continue?' || utils.abort

	rm -rf "${SCWRYPTS_LOG_PATH}" \
		&& echo.success 'all logfiles removed' \
		|| echo.error 'something went wrong (see above)' \
		;
}
