Compare commits
2 commits
a3ea2e6ef0
...
0926d058f5
Author | SHA1 | Date | |
---|---|---|---|
0926d058f5 | |||
b108ace00a |
2 changed files with 22 additions and 0 deletions
13
sh/code.awk
13
sh/code.awk
|
@ -31,6 +31,7 @@ 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_CLOSE = RE_BEGIN "}" RE_SPACES RE_END
|
||||
RE_COMMAND = RE_BEGIN "#/" RE_SPACES RE_VAR RE_END
|
||||
RE_CONSTANT = RE_BEGIN RE_CONST RE_SET RE_END
|
||||
|
@ -52,6 +53,10 @@ BEGIN {
|
|||
if (match($0, RE_ALIAS, 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]
|
||||
|
@ -143,3 +148,11 @@ BEGIN {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
if (action == "binaries") {
|
||||
for (binary in binaries) {
|
||||
print binary
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,8 @@ _rwx_code_awk="$(cat "${RWX_ROOT_SYSTEM}/code.awk")"
|
|||
_rwx_code_aliases=""
|
||||
# cache for code aliases functions
|
||||
_rwx_code_aliases_functions=""
|
||||
# cache for code binaries
|
||||
_rwx_code_binaries=""
|
||||
# cache for code commands
|
||||
_rwx_code_commands=""
|
||||
# cache for code constants
|
||||
|
@ -120,6 +122,11 @@ 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}"
|
||||
|
@ -182,6 +189,8 @@ rwx_code_load() {
|
|||
done <<EOF
|
||||
${_rwx_code_aliases_functions}
|
||||
EOF
|
||||
# parse binaries
|
||||
_rwx_code_binaries="$(rwx_code_parse "binaries")"
|
||||
# parse commands
|
||||
_rwx_code_commands="$(rwx_code_parse "commands")"
|
||||
# parse constants
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue