e7484103b9
===================================================================== 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)
48 lines
1.3 KiB
Bash
48 lines
1.3 KiB
Bash
#####################################################################
|
|
command -v compdef &>/dev/null || return 0
|
|
#####################################################################
|
|
|
|
for CLI in kubectl helm flux
|
|
do
|
|
eval "_${CLI[1]}() {
|
|
local SUBSESSION=0
|
|
local SUBSESSION_OFFSET=2
|
|
echo \${words[2]} | grep -q '^[0-9]\\+$' && SUBSESSION=\${words[2]} && SUBSESSION_OFFSET=3
|
|
|
|
local PASSTHROUGH_WORDS=($CLI)
|
|
[[ \$CURRENT -gt \${SUBSESSION_OFFSET} ]] && echo \${words[\${SUBSESSION_OFFSET}]} | grep -qv '^[0-9]\\+$' && {
|
|
local KUBECONTEXT=\$(k \$SUBSESSION meta get context)
|
|
local NAMESPACE=\$(k \$SUBSESSION meta get namespace)
|
|
|
|
[ \$KUBECONTEXT ] \
|
|
&& PASSTHROUGH_WORDS+=($([[ $CLI =~ ^helm$ ]] && echo '--kube-context' || echo '--context') \$KUBECONTEXT) \
|
|
;
|
|
[ \$NAMESPACE ] \
|
|
&& PASSTHROUGH_WORDS+=(--namespace \$NAMESPACE) \
|
|
;
|
|
}
|
|
|
|
local DELIMIT_COUNT=0
|
|
local WORD
|
|
for WORD in \${words[@]:1}
|
|
do
|
|
case \$WORD in
|
|
( [0-9]* ) continue ;;
|
|
( -- )
|
|
echo \$words | grep -q 'exec' && ((DELIMIT_COUNT+=1))
|
|
[[ \$DELIMIT_COUNT -eq 0 ]] && ((DELIMIT_COUNT+=1)) && continue
|
|
;;
|
|
esac
|
|
PASSTHROUGH_WORDS+=(\"\$WORD\")
|
|
done
|
|
|
|
echo \"\$words\" | grep -q '\\s\\+$' && PASSTHROUGH_WORDS+=(' ')
|
|
|
|
words=\"\${PASSTHROUGH_WORDS[@]}\"
|
|
_$CLI
|
|
}
|
|
"
|
|
|
|
compdef _${CLI[1]} ${CLI[1]}
|
|
done
|