parse/functions
This commit is contained in:
parent
2a9169947e
commit
6a73a8a740
1 changed files with 20 additions and 0 deletions
20
sh/main.sh
20
sh/main.sh
|
@ -195,6 +195,26 @@ rwx_find_shell() {
|
||||||
rwx_find_extension "sh" "${@}"
|
rwx_find_extension "sh" "${@}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ╭──────┬───────╮
|
||||||
|
# │ main │ parse │
|
||||||
|
# ╰──────┴───────╯
|
||||||
|
|
||||||
|
rwx_parse() {
|
||||||
|
local ws="[[:space:]]*"
|
||||||
|
local fn="${ws}(${ws})${ws}{"
|
||||||
|
local id="[_a-zA-Z][_a-z0-9A-Z]*"
|
||||||
|
local line
|
||||||
|
rwx_ifs_set
|
||||||
|
RWX_FUNCTIONS=""
|
||||||
|
for line in $(echo "${RWX_CODE}" |
|
||||||
|
grep "^${ws}${id}${fn}" |
|
||||||
|
sed "s|^${ws}\\(${id}\\)${fn}.*|\\1|"); do
|
||||||
|
RWX_FUNCTIONS="${RWX_FUNCTIONS}${line}
|
||||||
|
"
|
||||||
|
done
|
||||||
|
rwx_ifs_unset
|
||||||
|
}
|
||||||
|
|
||||||
# ╭──────┬─────╮
|
# ╭──────┬─────╮
|
||||||
# │ main │ run │
|
# │ main │ run │
|
||||||
# ╰──────┴─────╯
|
# ╰──────┴─────╯
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue