+core
This commit is contained in:
parent
9eefdb31f8
commit
d0bf0958c8
1 changed files with 21 additions and 17 deletions
38
sh/main.sh
38
sh/main.sh
|
@ -51,6 +51,25 @@ _rwx_main_log() {
|
||||||
# │ public │
|
# │ 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
|
# find directory’s files by extension
|
||||||
rwx_find_extension() {
|
rwx_find_extension() {
|
||||||
local extension="${1}"
|
local extension="${1}"
|
||||||
|
@ -70,31 +89,16 @@ rwx_find_extension() {
|
||||||
}
|
}
|
||||||
|
|
||||||
# find directory’s sh files
|
# find directory’s sh files
|
||||||
rwx_find_sh() {
|
rwx_find_shell() {
|
||||||
rwx_find_extension "sh" "${@}"
|
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() {
|
rwx_main_source() {
|
||||||
local path="${1}"
|
local path="${1}"
|
||||||
[ -d "${path}" ] ||
|
[ -d "${path}" ] ||
|
||||||
return 1
|
return 1
|
||||||
local cmd count module modules
|
local cmd count module modules
|
||||||
modules="$(rwx_find_sh "${path}" "${RWX_MAIN_NAME}")"
|
modules="$(rwx_find_shell "${path}" "${RWX_MAIN_NAME}")"
|
||||||
rwx_ifs_set
|
rwx_ifs_set
|
||||||
count=0
|
count=0
|
||||||
_rwx_main_log "" \
|
_rwx_main_log "" \
|
||||||
|
|
Loading…
Reference in a new issue