===================================================================== A follow-up to V5 focused on hardening the environment system and expanding the ZSH logging/caching toolkit. No migration required from v5.0.x, though note the log-level reorganization below may quiet some messages at lower verbosities. --- New Features ------------------------- - persistent cross-runtime cache for ZSH-type scwrypts; extends the v5.0 runtime speedup cache to survive between runs with automatic hash-based invalidation (toggle via SCWRYPTS__ZSH_CACHE_ENABLED) - new 'trace' log level (5) and echo.trace, plus '-v VARNAME' state injection for echo.debug / echo.trace to surface variable values inline - additional scwrypts output formats: 'raw' and 'logfmt' (alongside pretty and json) - normalize.boolean utility for consistent truthy/falsey handling across ZSH-type scwrypts - utils.fzf.file-select for directory-scoped file selection prompts - automatic dependency wrappers providing default arguments, GNU coreutil resolution, and scwrypts trace on wrapped commands --- Changes ------------------------------ - log levels reorganized; success / status / reminder messages now emit at level 3, so lower verbosities will show fewer of these - environment library restructured around get-user-json as the single source of truth (replaces the previous user module and cache-output) - utility renames for consistency: user.Yn / user.yN (from utils.*) - utils.fail and utils.abort deprecated in favor of echo.error and echo.error.user-abort --- Bug Fixes ---------------------------- - CI runs now resolve config lookup-paths (.dotted.path) to their environment variable before reading, fixing false "not set" reports and invalid-export errors for lookup-path checks in CI - hardened environment type detection so array-valued configs reprint correctly after their first check - corrected exit-code capture in the cache layer (now reflects the cached command, not the downstream output filter) - scwrypt exit code now survives the logging pipeline - assorted script fixes (efs unmount file listing, postgres run-sql file discovery)
46 lines
1.3 KiB
Bash
46 lines
1.3 KiB
Bash
#####################################################################
|
|
|
|
utils.fail() { # displays a crash error and exit
|
|
echo.warning "utils.fail emits an 'exit' code which may unexpectedly terminate the entire scwrypts process"
|
|
echo.warning "deprecation warning: ${0} will be removed in scwrypts v5.3+"
|
|
echo.error --force-print ${@:2}
|
|
exit $1
|
|
}
|
|
|
|
utils.abort() { # for consistency; use after user aborts REQUIRED input
|
|
echo.warning "deprecation warning: this will be removed in scwrypts v5.3+"
|
|
utils.fail 69 'user abort'
|
|
}
|
|
|
|
echo.user-abort() {
|
|
echo.error 'user abort' "${@}"
|
|
}
|
|
|
|
#####################################################################
|
|
|
|
utils.check-errors() { # returns an error and reports usage if 'echo.error' was ever called
|
|
[ ${ERRORS} ] && [[ ${ERRORS} -ne 0 ]] || return 0
|
|
|
|
local DISPLAY_USAGE=true
|
|
local FAIL_OUT=false
|
|
|
|
while [[ $# -gt 0 ]]
|
|
do
|
|
case $1 in
|
|
( --no-usage ) DISPLAY_USAGE=false ;;
|
|
( --fail ) FAIL_OUT=true ;;
|
|
|
|
( --no-fail )
|
|
echo.warning "utils.check-errors : '--no-fail' is now the default behavior"
|
|
;;
|
|
esac
|
|
shift 1
|
|
done
|
|
|
|
[[ ${DISPLAY_USAGE} =~ true ]] && utils.io.usage
|
|
|
|
[[ ${FAIL_OUT} =~ true ]] && exit ${ERRORS} || return ${ERRORS}
|
|
}
|
|
|
|
#####################################################################
|