Compare commits
4 commits
beb3025828
...
bb787cc0cc
Author | SHA1 | Date | |
---|---|---|---|
bb787cc0cc | |||
d367548c08 | |||
ec9907d450 | |||
ad235af38f |
2 changed files with 33 additions and 4 deletions
|
@ -7,7 +7,6 @@ function append(line) {
|
||||||
|
|
||||||
function output(name) {
|
function output(name) {
|
||||||
print name
|
print name
|
||||||
print "↓"
|
|
||||||
print doc
|
print doc
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
@ -45,7 +44,7 @@ BEGIN {
|
||||||
} else if (match($0, RE_DOC, m)) {
|
} else if (match($0, RE_DOC, m)) {
|
||||||
append(m[1])
|
append(m[1])
|
||||||
} else if (match($0, RE_ALIAS, m)) {
|
} else if (match($0, RE_ALIAS, m)) {
|
||||||
append(m[1])
|
append("alias: " m[1])
|
||||||
if (m[1] == target) {
|
if (m[1] == target) {
|
||||||
alias = 1
|
alias = 1
|
||||||
}
|
}
|
||||||
|
@ -57,20 +56,24 @@ BEGIN {
|
||||||
}
|
}
|
||||||
} else if (match($0, RE_SET, m)) {
|
} else if (match($0, RE_SET, m)) {
|
||||||
if (m[1] == target) {
|
if (m[1] == target) {
|
||||||
|
print "set"
|
||||||
output(m[1])
|
output(m[1])
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
} else if (match($0, RE_FUNCTION, m)) {
|
} else if (match($0, RE_FUNCTION, m)) {
|
||||||
if (alias) {
|
if (alias) {
|
||||||
|
print "alias"
|
||||||
output(target)
|
output(target)
|
||||||
} else if (m[1] == target) {
|
} else if (m[1] == target) {
|
||||||
|
print "function"
|
||||||
output(target)
|
output(target)
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (module) {
|
if (module) {
|
||||||
|
print "module"
|
||||||
output(target)
|
output(target)
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
|
|
30
sh/main.sh
30
sh/main.sh
|
@ -1,9 +1,8 @@
|
||||||
#! /usr/bin/env sh
|
#! /usr/bin/env sh
|
||||||
# main module
|
|
||||||
|
|
||||||
# ╭──────╮
|
# ╭──────╮
|
||||||
# │ main │
|
# │ main │
|
||||||
# ╰──────╯
|
# ╰──────╯
|
||||||
|
# main module
|
||||||
|
|
||||||
# ╭──────┬───────────╮
|
# ╭──────┬───────────╮
|
||||||
# │ main │ constants │
|
# │ main │ constants │
|
||||||
|
@ -11,8 +10,10 @@
|
||||||
|
|
||||||
# name of the entrypoint file
|
# name of the entrypoint file
|
||||||
RWX_MAIN_NAME="main.sh"
|
RWX_MAIN_NAME="main.sh"
|
||||||
|
# name of the project itself
|
||||||
RWX_SELF_NAME="rwx"
|
RWX_SELF_NAME="rwx"
|
||||||
|
|
||||||
|
# prefix for command functions
|
||||||
RWX_SELF_COMMAND="_${RWX_SELF_NAME}_cmd_"
|
RWX_SELF_COMMAND="_${RWX_SELF_NAME}_cmd_"
|
||||||
|
|
||||||
# ╭──────┬───────────╮
|
# ╭──────┬───────────╮
|
||||||
|
@ -194,6 +195,31 @@ rwx_parse_functions() {
|
||||||
sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p"
|
sed --silent "s|${RWX_REGEX_TARGET_FUNCTION}|\\1|p"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ╭──────┬──────╮
|
||||||
|
# │ main │ test │
|
||||||
|
# ╰──────┴──────╯
|
||||||
|
|
||||||
|
rwx_test() {
|
||||||
|
local item
|
||||||
|
# TODO CODE
|
||||||
|
# TODO CONSTANTS
|
||||||
|
# TODO functions
|
||||||
|
# TODO variables
|
||||||
|
set \
|
||||||
|
"main" \
|
||||||
|
"self" \
|
||||||
|
\
|
||||||
|
"RWX_MAIN_NAME" \
|
||||||
|
\
|
||||||
|
"rwx_cache" \
|
||||||
|
\
|
||||||
|
"gsc"
|
||||||
|
for item in "${@}"; do
|
||||||
|
echo
|
||||||
|
rwx_doc "${item}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# ╭──────┬─────╮
|
# ╭──────┬─────╮
|
||||||
# │ main │ run │
|
# │ main │ run │
|
||||||
# ╰──────┴─────╯
|
# ╰──────┴─────╯
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue