From b93a6909bb4275ac5f85cf19514b6aceca122f71 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Fri, 29 Nov 2024 15:42:58 +0100 Subject: [PATCH] comments --- sh/main.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sh/main.sh b/sh/main.sh index 4c99298..e91efbf 100644 --- a/sh/main.sh +++ b/sh/main.sh @@ -37,6 +37,7 @@ _sh_main_log() { # public +# find directory’s files by extension sh_find_extension() { local extension="${1}" local root="${2}" @@ -54,16 +55,19 @@ sh_find_extension() { sort } +# find directory’s sh files sh_find_sh() { sh_find_extension "sh" "${@}" } +# get functions from file sh_grep_functions() { local file="${1}" grep "()" "${file}" | cut --delimiter "(" --fields 1 } +# output help message sh_help() { sh_log \ "sh_… = shell functions" \ @@ -71,6 +75,7 @@ sh_help() { "u__… = user" } +# test if active shell is in interactive mode sh_shell_interactive() { case "${-}" in *i*) ;; @@ -106,18 +111,25 @@ sh_source_directory() { # main +# run initial steps sh_main() { + # system root if ! sh_source_directory "${SH_ROOT}"; then _sh_main_log "Not a directory: ${SH_ROOT}" return 1 fi + # user root sh_source_directory "${SH_USER}" + # run interactive extras if sh_shell_interactive; then + # check sh_log sh_shellcheck "${SH_ROOT}" + # help sh_log sh_help fi } +# run main function sh_main