From f4c0bb36c1bd6e30848cf23a592b176030246956 Mon Sep 17 00:00:00 2001 From: "Lockszmith (@kateryna)" Date: Sun, 24 Nov 2024 21:52:17 -0500 Subject: [PATCH] Minor improvement to sz.env load process --- .../sz.env/000_stop_on_non_interactive_sessions.env | 2 ++ _home/private_dot_config/sz.env/PATH_zz_cleanup.env | 3 +++ _home/private_dot_config/sz.env/envman-and-webi.env | 9 ++++++++- _home/private_dot_config/sz.env/executable__.load.sh | 3 +++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env b/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env index ccfc5ce..6e83c75 100644 --- a/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env +++ b/_home/private_dot_config/sz.env/000_stop_on_non_interactive_sessions.env @@ -3,4 +3,6 @@ if [[ ! "$-" =~ i ]]; then LOAD_EXIT=1 echo "Non interactive session ($-) , stopping load of shell environment" 1>&2 +else + reset fi diff --git a/_home/private_dot_config/sz.env/PATH_zz_cleanup.env b/_home/private_dot_config/sz.env/PATH_zz_cleanup.env index b910958..7556855 100644 --- a/_home/private_dot_config/sz.env/PATH_zz_cleanup.env +++ b/_home/private_dot_config/sz.env/PATH_zz_cleanup.env @@ -10,3 +10,6 @@ done NEWPATH="$NEWPATH:$OLDPATH" export PATH="$NEWPATH" unset NEWPATH OLDPATH colon entry search + +[[ -n "${DBG}" ]] && echo "${PATH//:/\n}" + diff --git a/_home/private_dot_config/sz.env/envman-and-webi.env b/_home/private_dot_config/sz.env/envman-and-webi.env index 9757b80..f59d5de 100644 --- a/_home/private_dot_config/sz.env/envman-and-webi.env +++ b/_home/private_dot_config/sz.env/envman-and-webi.env @@ -1,6 +1,13 @@ #!/usr/bin/env -S bash -c 'echo "Not a user script. source(aka .) only"' -[ -s "$HOME/.config/envman/load.sh" ] && source "$HOME/.config/envman/load.sh" +export ENVMAN_LOAD='' + +if [ -s "$HOME/.config/envman/load.sh" ]; then + [[ -n "${DBG}" ]] && echo "Loading envman" + source "$HOME/.config/envman/load.sh" + + [[ -n "${DBG}" ]] && echo "${PATH//:/\n}" +fi if is_cmd webi; then . <(webi --init "${SHELL##*/}") diff --git a/_home/private_dot_config/sz.env/executable__.load.sh b/_home/private_dot_config/sz.env/executable__.load.sh index c32c27a..b1c95bd 100644 --- a/_home/private_dot_config/sz.env/executable__.load.sh +++ b/_home/private_dot_config/sz.env/executable__.load.sh @@ -57,6 +57,9 @@ if is_sourced; then -exec sh -c ' find "$1" -xdev -maxdepth 1 -type f -name "*.env" -not -name "ID_*" -not -name "PATH_*" -print | sort ' shell '{}' ';' \ + -exec sh -c ' + find "$1" -xdev -maxdepth 1 -type f -name "PATH_zz_cleanup.env" + ' shell '{}' ';' \ | sed -e 's/^/load_next "/; s/$/";/' )" if [ -n "$DBG_NO_SZ_LOAD" ]; then