self/functions
This commit is contained in:
parent
245aa85f29
commit
5fc07cfbc1
2 changed files with 11 additions and 18 deletions
19
sh/main.sh
19
sh/main.sh
|
@ -16,17 +16,6 @@ RWX_SYSTEM_ROOT="/usr/local/lib"
|
|||
RWX_MAIN_PATH="${RWX_ROOT_SYSTEM}/${RWX_MAIN_NAME}"
|
||||
RWX_ROOT_SYSTEM="${RWX_SYSTEM_ROOT}/${RWX_SELF_NAME}"
|
||||
|
||||
# ╭────────╮
|
||||
# │ public │
|
||||
# ╰────────╯
|
||||
|
||||
# get functions from file
|
||||
rwx_grep_functions() {
|
||||
local file="${1}"
|
||||
grep "()" "${file}" |
|
||||
cut --delimiter "(" --fields 1
|
||||
}
|
||||
|
||||
# ╭──────╮
|
||||
# │ core │
|
||||
# ╰──────╯
|
||||
|
@ -103,7 +92,7 @@ rwx_source() {
|
|||
local path="${1}"
|
||||
[ -d "${path}" ] ||
|
||||
return 1
|
||||
local cmd count module modules
|
||||
local count module modules
|
||||
modules="$(rwx_find_shell "${path}" "${RWX_MAIN_NAME}")"
|
||||
rwx_ifs_set
|
||||
count=0
|
||||
|
@ -115,12 +104,6 @@ rwx_source() {
|
|||
module="${path}/${module}"
|
||||
# shellcheck disable=SC1090
|
||||
. "${module}"
|
||||
cmd="$(rwx_grep_functions "${module}")"
|
||||
if [ -n "${cmd}" ]; then
|
||||
[ -n "${CMD}" ] && CMD="${CMD}
|
||||
"
|
||||
CMD="${CMD}${cmd}"
|
||||
fi
|
||||
done
|
||||
rwx_ifs_unset
|
||||
}
|
||||
|
|
10
sh/self.sh
10
sh/self.sh
|
@ -1,3 +1,13 @@
|
|||
# get functions from file
|
||||
rwx_self_functions() {
|
||||
local file="${1}"
|
||||
grep \
|
||||
--directories "recurse" \
|
||||
--no-filename \
|
||||
"()" "${RWX_ROOT_SYSTEM}" |
|
||||
cut --delimiter "(" --fields 1
|
||||
}
|
||||
|
||||
# output help message
|
||||
rwx_self_help() {
|
||||
rwx_log \
|
||||
|
|
Loading…
Reference in a new issue