From ee694a8fdee08beb2273389f19a16be1ff90336f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Wed, 20 Nov 2024 16:47:41 +0100 Subject: [PATCH] main/log --- sh/main.sh | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/sh/main.sh b/sh/main.sh index 68bc516..d2fafb8 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -15,6 +15,18 @@ _sh_main_commands() { cut --delimiter "(" --fields 1 } +_sh_main_log() { + case "${-}" in + *i*) + local argument + for argument in "${@}"; do + echo "${argument}" + done + ;; + *) ;; + esac +} + main_source_directory() { local path="${1}" if [ -d "${path}" ]; then @@ -28,12 +40,12 @@ main_source_directory() { IFS=" " count=0 - #echo - #echo ". ${path}" + _sh_main_log "" \ + ". ${path}" for module in ${modules}; do count=$((count + 1)) #printf "%02d" "${count}" - #echo " ${module%.sh}" + _sh_main_log "${module%.sh}" module="${path}/${module}" if [ "${module}" != "${ENV}" ]; then . "${module}" @@ -47,7 +59,7 @@ main_source_directory() { done IFS="${ifs}" else - #echo "Not a directory: ${path}" + _sh_main_log "Not a directory: ${path}" return 1 fi } @@ -57,7 +69,7 @@ main_source_file() { if [ -f "${path}" ]; then main_source_directory "$(dirname "${path}")" else - #echo "Not a file: ${path}" + _sh_main_log "Not a file: ${path}" return 1 fi } @@ -66,7 +78,7 @@ main_source_file "${ENV}" main_source_directory "${SH_USER}" -#sh_log "" \ -# "sh_… = shell functions" \ -# "a__… = aliases" \ -# "u__… = user" +_sh_main_log "" \ + "sh_… = shell functions" \ + "a__… = aliases" \ + "u__… = user"