This commit is contained in:
Marc Beninca 2024-11-29 23:03:52 +01:00
parent 9eefdb31f8
commit d0bf0958c8
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -51,6 +51,25 @@ _rwx_main_log() {
# │ public │
# ╰────────╯
# get functions from file
rwx_grep_functions() {
local file="${1}"
grep "()" "${file}" |
cut --delimiter "(" --fields 1
}
# test if active shell is in interactive mode
rwx_shell_interactive() {
case "${-}" in
*i*) ;;
*) return 1 ;;
esac
}
# ╭──────╮
# │ core │
# ╰──────╯
# find directory’s files by extension
rwx_find_extension() {
local extension="${1}"
@ -70,31 +89,16 @@ rwx_find_extension() {
}
# find directory’s sh files
rwx_find_sh() {
rwx_find_shell() {
rwx_find_extension "sh" "${@}"
}
# get functions from file
rwx_grep_functions() {
local file="${1}"
grep "()" "${file}" |
cut --delimiter "(" --fields 1
}
# test if active shell is in interactive mode
rwx_shell_interactive() {
case "${-}" in
*i*) ;;
*) return 1 ;;
esac
}
rwx_main_source() {
local path="${1}"
[ -d "${path}" ] ||
return 1
local cmd count module modules
modules="$(rwx_find_sh "${path}" "${RWX_MAIN_NAME}")"
modules="$(rwx_find_shell "${path}" "${RWX_MAIN_NAME}")"
rwx_ifs_set
count=0
_rwx_main_log "" \