Compare commits
2 commits
9823f99e7c
...
4dbc9d060a
Author | SHA1 | Date | |
---|---|---|---|
4dbc9d060a | |||
c03f0792d8 |
3 changed files with 39 additions and 1 deletions
|
@ -28,6 +28,7 @@ BEGIN {
|
||||||
RE_CONST = "([_A-Z][_0-9A-Z]*)"
|
RE_CONST = "([_A-Z][_0-9A-Z]*)"
|
||||||
RE_SET = "=.*"
|
RE_SET = "=.*"
|
||||||
RE_SPACE = "[[:space:]]"
|
RE_SPACE = "[[:space:]]"
|
||||||
|
RE_TSK = "(FIXME|TODO)"
|
||||||
RE_VAR = "([_a-z][_0-9a-z]*)"
|
RE_VAR = "([_a-z][_0-9a-z]*)"
|
||||||
|
|
||||||
RE_SPACES = RE_SPACE "*"
|
RE_SPACES = RE_SPACE "*"
|
||||||
|
@ -39,17 +40,20 @@ BEGIN {
|
||||||
RE_BINARY = RE_BEGIN "#\\|" RE_SPACES RE_VAR RE_END
|
RE_BINARY = RE_BEGIN "#\\|" RE_SPACES RE_VAR RE_END
|
||||||
RE_CLOSE = RE_BEGIN "}" RE_SPACES RE_END
|
RE_CLOSE = RE_BEGIN "}" RE_SPACES RE_END
|
||||||
RE_COMMAND = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END
|
RE_COMMAND = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END
|
||||||
|
RE_COMMENT = RE_BEGIN "#" RE_ANY RE_END
|
||||||
RE_CONSTANT = RE_BEGIN RE_CONST RE_SET RE_END
|
RE_CONSTANT = RE_BEGIN RE_CONST RE_SET RE_END
|
||||||
RE_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END
|
RE_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END
|
||||||
RE_FUNCTION = RE_BEGIN RE_VAR RE_FUNC RE_END
|
RE_FUNCTION = RE_BEGIN RE_VAR RE_FUNC RE_END
|
||||||
RE_MODULE = RE_BEGIN "#." RE_SPACES RE_ANY RE_END
|
RE_MODULE = RE_BEGIN "#\\." RE_SPACES RE_ANY RE_END
|
||||||
RE_SHEBANG = RE_BEGIN "#!" RE_SPACES RE_ANY RE_END
|
RE_SHEBANG = RE_BEGIN "#!" RE_SPACES RE_ANY RE_END
|
||||||
|
RE_TASK = RE_BEGIN RE_SPACES "#" RE_SPACES RE_TSK RE_ANY RE_END
|
||||||
RE_VARIABLE = RE_BEGIN RE_VAR RE_SET RE_END
|
RE_VARIABLE = RE_BEGIN RE_VAR RE_SET RE_END
|
||||||
|
|
||||||
f = ""
|
f = ""
|
||||||
match_alias = 0
|
match_alias = 0
|
||||||
match_command = 0
|
match_command = 0
|
||||||
match_module = 0
|
match_module = 0
|
||||||
|
match_task = 0
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,6 +78,29 @@ BEGIN {
|
||||||
if (match($0, RE_FUNCTION, m)) {
|
if (match($0, RE_FUNCTION, m)) {
|
||||||
print m[1]
|
print m[1]
|
||||||
}
|
}
|
||||||
|
} else if (action == "tasks") {
|
||||||
|
if (match($0, RE_MODULE, m)) {
|
||||||
|
if (output_tasks) {
|
||||||
|
print ""
|
||||||
|
print output_module
|
||||||
|
print output_tasks
|
||||||
|
output_tasks = ""
|
||||||
|
}
|
||||||
|
doc = ""
|
||||||
|
match_task = 0
|
||||||
|
output_module = ". " m[1]
|
||||||
|
} else if (match($0, RE_TASK, m)) {
|
||||||
|
match_task = 1
|
||||||
|
append($0)
|
||||||
|
} else if (match($0, RE_COMMENT, m)) {
|
||||||
|
append($0)
|
||||||
|
} else {
|
||||||
|
if (match_task) {
|
||||||
|
output_tasks = output_tasks "\n" doc
|
||||||
|
}
|
||||||
|
doc = ""
|
||||||
|
match_task = 0
|
||||||
|
}
|
||||||
} else if (action == "variables") {
|
} else if (action == "variables") {
|
||||||
if (match($0, RE_VARIABLE, m)) {
|
if (match($0, RE_VARIABLE, m)) {
|
||||||
print m[1]
|
print m[1]
|
||||||
|
|
|
@ -34,6 +34,8 @@ _rwx_code_commands_functions=""
|
||||||
_rwx_code_constants=""
|
_rwx_code_constants=""
|
||||||
# cache for code functions
|
# cache for code functions
|
||||||
_rwx_code_functions=""
|
_rwx_code_functions=""
|
||||||
|
# cache for code tasks
|
||||||
|
_rwx_code_tasks=""
|
||||||
# cache for code variables
|
# cache for code variables
|
||||||
_rwx_code_variables=""
|
_rwx_code_variables=""
|
||||||
|
|
||||||
|
@ -175,6 +177,12 @@ rwx_code_modules_user() {
|
||||||
echo "${rwx_code_modules_user}"
|
echo "${rwx_code_modules_user}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# show the cached tasks
|
||||||
|
#= rct
|
||||||
|
rwx_code_tasks() {
|
||||||
|
echo "${_rwx_code_tasks}"
|
||||||
|
}
|
||||||
|
|
||||||
# show the cached variables
|
# show the cached variables
|
||||||
#= rcv
|
#= rcv
|
||||||
rwx_code_variables() {
|
rwx_code_variables() {
|
||||||
|
@ -233,6 +241,8 @@ EOF
|
||||||
_rwx_code_constants="$(rwx_code_parse "constants")"
|
_rwx_code_constants="$(rwx_code_parse "constants")"
|
||||||
# parse functions
|
# parse functions
|
||||||
_rwx_code_functions="$(rwx_code_parse "functions")"
|
_rwx_code_functions="$(rwx_code_parse "functions")"
|
||||||
|
# parse tasks
|
||||||
|
_rwx_code_tasks="$(rwx_code_parse "tasks")"
|
||||||
# parse variables
|
# parse variables
|
||||||
_rwx_code_variables="$(rwx_code_parse "variables")"
|
_rwx_code_variables="$(rwx_code_parse "variables")"
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ rwx_main_path="${rwx_main_root}/${rwx_main_file}"
|
||||||
# │ main │ find │
|
# │ main │ find │
|
||||||
# ╰──────┴──────╯
|
# ╰──────┴──────╯
|
||||||
|
|
||||||
|
# FIXME separate in two functions
|
||||||
# find root directory shell modules
|
# find root directory shell modules
|
||||||
#| find
|
#| find
|
||||||
#| sed
|
#| sed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue