Compare commits
6 commits
f9252e1ee8
...
56b77357bb
Author | SHA1 | Date | |
---|---|---|---|
56b77357bb | |||
148a9aef96 | |||
28064567e1 | |||
38bcab046b | |||
c3449a1148 | |||
ba8dee99e7 |
3 changed files with 109 additions and 113 deletions
|
@ -41,9 +41,9 @@ BEGIN {
|
|||
RE_FUNC = RE_SPACES "\\(" RE_SPACES "\\)" RE_SPACES "{"
|
||||
|
||||
re["alias"] = RE_BEGIN "#=" RE_SPACES RE_VAR RE_END
|
||||
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_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_DOC = RE_BEGIN RE_SPACES "#" RE_SPACE RE_ANY RE_END
|
||||
|
@ -64,15 +64,7 @@ BEGIN {
|
|||
{
|
||||
if (action == "filter") {
|
||||
if (match($0, re[target], m)) {
|
||||
print m[1]
|
||||
}
|
||||
} else if (action == "binaries") {
|
||||
if (match($0, RE_BINARY, m)) {
|
||||
binaries[m[1]] = ""
|
||||
}
|
||||
} else if (action == "commands") {
|
||||
if (match($0, RE_COMMAND, m)) {
|
||||
print m[1]
|
||||
unique[m[1]] = ""
|
||||
}
|
||||
} else if (action == "tasks") {
|
||||
if (match($0, RE_MODULE, m)) {
|
||||
|
@ -120,7 +112,7 @@ BEGIN {
|
|||
reset()
|
||||
}
|
||||
} else if (action == "commands functions") {
|
||||
if (match($0, RE_COMMAND, m)) {
|
||||
if (match($0, re["command"], m)) {
|
||||
append(m[1])
|
||||
} else if (match($0, re["function"], m)) {
|
||||
split(doc, array, "\n")
|
||||
|
@ -132,7 +124,7 @@ BEGIN {
|
|||
reset()
|
||||
}
|
||||
} else if (action == "command function") {
|
||||
if (match($0, RE_COMMAND, m)) {
|
||||
if (match($0, re["command"], m)) {
|
||||
append(m[1])
|
||||
} else if (match($0, re["function"], m)) {
|
||||
split(doc, array, "\n")
|
||||
|
@ -161,7 +153,7 @@ BEGIN {
|
|||
if (m[1] == target) {
|
||||
match_alias = 1
|
||||
}
|
||||
} else if (match($0, RE_COMMAND, m)) {
|
||||
} else if (match($0, re["command"], m)) {
|
||||
append("/ " m[1])
|
||||
if (m[1] == target) {
|
||||
match_command = 1
|
||||
|
@ -211,9 +203,9 @@ BEGIN {
|
|||
}
|
||||
|
||||
END {
|
||||
if (action == "binaries") {
|
||||
for (binary in binaries) {
|
||||
print binary
|
||||
if (action == "filter") {
|
||||
for (item in unique) {
|
||||
print item
|
||||
}
|
||||
}
|
||||
# FIXME tasks last module end
|
||||
|
|
192
sh/core/code.sh
192
sh/core/code.sh
|
@ -41,14 +41,30 @@ _rwx_code_tasks_todo=""
|
|||
# cache for code variables
|
||||
_rwx_code_variables=""
|
||||
|
||||
# ╭──────┬───────╮
|
||||
# │ code │ cache │
|
||||
# ╰──────┴───────╯
|
||||
# ╭──────┬───────────╮
|
||||
# │ code │ functions │
|
||||
# ╰──────┴───────────╯
|
||||
|
||||
# output all cached code
|
||||
rwx_code_cache() {
|
||||
rwx_code_cache_main
|
||||
rwx_code_cache_user
|
||||
# show the cached awk script
|
||||
rwx_code_awk() {
|
||||
echo "${_rwx_code_awk}"
|
||||
}
|
||||
|
||||
# show the cached aliases
|
||||
#= rca
|
||||
rwx_code_aliases() {
|
||||
echo "${_rwx_code_aliases}"
|
||||
}
|
||||
|
||||
# show the cached aliases and functions
|
||||
#= rcaf
|
||||
rwx_code_aliases_functions() {
|
||||
echo "${_rwx_code_aliases_functions}"
|
||||
}
|
||||
|
||||
# show the cached binaries
|
||||
rwx_code_binaries() {
|
||||
echo "${_rwx_code_binaries}"
|
||||
}
|
||||
|
||||
# output cached main code
|
||||
|
@ -61,6 +77,75 @@ rwx_code_cache_user() {
|
|||
echo "${rwx_code_cache_user}"
|
||||
}
|
||||
|
||||
# show the cached commands
|
||||
rwx_code_commands() {
|
||||
echo "${_rwx_code_commands}"
|
||||
}
|
||||
|
||||
# show the cached commands and functions
|
||||
#= rccf
|
||||
rwx_code_commands_functions() {
|
||||
echo "${_rwx_code_commands_functions}"
|
||||
}
|
||||
|
||||
# show the cached constants
|
||||
#= rcc
|
||||
rwx_code_constants() {
|
||||
echo "${_rwx_code_constants}"
|
||||
}
|
||||
|
||||
# show the cached functions
|
||||
#= rcf
|
||||
rwx_code_functions() {
|
||||
echo "${_rwx_code_functions}"
|
||||
}
|
||||
|
||||
# show the cached main modules
|
||||
#= rcmm
|
||||
rwx_code_modules_main() {
|
||||
echo "${rwx_code_modules_main}"
|
||||
}
|
||||
|
||||
# show the cached user modules
|
||||
#= rcmu
|
||||
rwx_code_modules_user() {
|
||||
echo "${rwx_code_modules_user}"
|
||||
}
|
||||
|
||||
# show the cached tasks
|
||||
#= rct
|
||||
rwx_code_tasks() {
|
||||
echo "${_rwx_code_tasks}"
|
||||
}
|
||||
|
||||
# show the cached fixme tasks
|
||||
#= rctf
|
||||
rwx_code_tasks_fixme() {
|
||||
echo "${_rwx_code_tasks_fixme}"
|
||||
}
|
||||
|
||||
# show the cached todo tasks
|
||||
#= rctt
|
||||
rwx_code_tasks_todo() {
|
||||
echo "${_rwx_code_tasks_todo}"
|
||||
}
|
||||
|
||||
# show the cached variables
|
||||
#= rcv
|
||||
rwx_code_variables() {
|
||||
echo "${_rwx_code_variables}"
|
||||
}
|
||||
|
||||
# ╭──────┬───────╮
|
||||
# │ code │ cache │
|
||||
# ╰──────┴───────╯
|
||||
|
||||
# output all cached code
|
||||
rwx_code_cache() {
|
||||
rwx_code_cache_main
|
||||
rwx_code_cache_user
|
||||
}
|
||||
|
||||
# ╭──────┬─────────╮
|
||||
# │ code │ install │
|
||||
# ╰──────┴─────────╯
|
||||
|
@ -104,11 +189,6 @@ export ENV=\"${rwx_main_path}\"
|
|||
# │ code │ parts │
|
||||
# ╰──────┴───────╯
|
||||
|
||||
# show the cached awk script
|
||||
rwx_code_awk() {
|
||||
echo "${_rwx_code_awk}"
|
||||
}
|
||||
|
||||
# call awk for action with target
|
||||
rwx_code_action_target() {
|
||||
local action="${1}"
|
||||
|
@ -121,12 +201,6 @@ rwx_code_action_target() {
|
|||
"${_rwx_code_awk}"
|
||||
}
|
||||
|
||||
# show the cached aliases
|
||||
#= rca
|
||||
rwx_code_aliases() {
|
||||
echo "${_rwx_code_aliases}"
|
||||
}
|
||||
|
||||
# find command function
|
||||
rwx_code_command_function() {
|
||||
local name="${1}"
|
||||
|
@ -138,40 +212,6 @@ rwx_code_command_function() {
|
|||
"${_rwx_code_awk}"
|
||||
}
|
||||
|
||||
# show the cached aliases and functions
|
||||
#= rcaf
|
||||
rwx_code_aliases_functions() {
|
||||
echo "${_rwx_code_aliases_functions}"
|
||||
}
|
||||
|
||||
# show the cached binaries
|
||||
rwx_code_binaries() {
|
||||
echo "${_rwx_code_binaries}"
|
||||
}
|
||||
|
||||
# show the cached commands
|
||||
rwx_code_commands() {
|
||||
echo "${_rwx_code_commands}"
|
||||
}
|
||||
|
||||
# show the cached commands and functions
|
||||
#= rccf
|
||||
rwx_code_commands_functions() {
|
||||
echo "${_rwx_code_commands_functions}"
|
||||
}
|
||||
|
||||
# show the cached constants
|
||||
#= rcc
|
||||
rwx_code_constants() {
|
||||
echo "${_rwx_code_constants}"
|
||||
}
|
||||
|
||||
# show the cached functions
|
||||
#= rcf
|
||||
rwx_code_functions() {
|
||||
echo "${_rwx_code_functions}"
|
||||
}
|
||||
|
||||
# show all the cached main modules
|
||||
#= rcm
|
||||
rwx_code_modules() {
|
||||
|
@ -179,42 +219,6 @@ rwx_code_modules() {
|
|||
rwx_code_modules_user
|
||||
}
|
||||
|
||||
# show the cached main modules
|
||||
#= rcmm
|
||||
rwx_code_modules_main() {
|
||||
echo "${rwx_code_modules_main}"
|
||||
}
|
||||
|
||||
# show the cached user modules
|
||||
#= rcmu
|
||||
rwx_code_modules_user() {
|
||||
echo "${rwx_code_modules_user}"
|
||||
}
|
||||
|
||||
# show the cached tasks
|
||||
#= rct
|
||||
rwx_code_tasks() {
|
||||
echo "${_rwx_code_tasks}"
|
||||
}
|
||||
|
||||
# show the cached fixme tasks
|
||||
#= rctf
|
||||
rwx_code_tasks_fixme() {
|
||||
echo "${_rwx_code_tasks_fixme}"
|
||||
}
|
||||
|
||||
# show the cached todo tasks
|
||||
#= rctt
|
||||
rwx_code_tasks_todo() {
|
||||
echo "${_rwx_code_tasks_todo}"
|
||||
}
|
||||
|
||||
# show the cached variables
|
||||
#= rcv
|
||||
rwx_code_variables() {
|
||||
echo "${_rwx_code_variables}"
|
||||
}
|
||||
|
||||
# ╭──────┬───────╮
|
||||
# │ code │ parse │
|
||||
# ╰──────┴───────╯
|
||||
|
@ -258,21 +262,21 @@ EOF
|
|||
${_rwx_code_commands_functions}
|
||||
EOF
|
||||
# parse aliases
|
||||
_rwx_code_aliases="$(rwx_code_action_target "filter" "alias")"
|
||||
_rwx_code_aliases="$(rwx_code_action_target "filter" "alias" | sort)"
|
||||
# parse binaries
|
||||
_rwx_code_binaries="$(rwx_code_parse "binaries")"
|
||||
_rwx_code_binaries="$(rwx_code_action_target "filter" "binary")"
|
||||
# parse commands
|
||||
_rwx_code_commands="$(rwx_code_parse "commands")"
|
||||
_rwx_code_commands="$(rwx_code_action_target "filter" "command")"
|
||||
# parse constants
|
||||
_rwx_code_constants="$(rwx_code_action_target "filter" "constants")"
|
||||
_rwx_code_constants="$(rwx_code_action_target "filter" "constant" | sort)"
|
||||
# parse functions
|
||||
_rwx_code_functions="$(rwx_code_action_target "filter" "function")"
|
||||
_rwx_code_functions="$(rwx_code_action_target "filter" "function" | sort)"
|
||||
# parse tasks
|
||||
_rwx_code_tasks="$(rwx_code_action_target "tasks")"
|
||||
_rwx_code_tasks_fixme="$(rwx_code_action_target "tasks" "FIXME")"
|
||||
_rwx_code_tasks_todo="$(rwx_code_action_target "tasks" "TODO")"
|
||||
# parse variables
|
||||
_rwx_code_variables="$(rwx_code_action_target "filter" "variable")"
|
||||
_rwx_code_variables="$(rwx_code_action_target "filter" "variable" | sort)"
|
||||
}
|
||||
|
||||
rwx_code_parse() {
|
||||
|
|
|
@ -71,9 +71,9 @@ rwx_main_main() {
|
|||
${modules}
|
||||
EOF
|
||||
# run code module main function with found main modules
|
||||
rwx_code_main "${modules}" "${@}"
|
||||
rwx_code_main "${modules}"
|
||||
# run shell module main function
|
||||
rwx_shell_main
|
||||
rwx_shell_main "${@}"
|
||||
}
|
||||
|
||||
# run main function
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue