Compare commits

..

No commits in common. "d80b61f490de04e388f2af1e5909b30373691c8a" and "d366245c2df0ffc0d3d0351017950424da24141a" have entirely different histories.

2 changed files with 21 additions and 9 deletions

View file

@ -5,10 +5,6 @@ function append(line) {
doc = doc line
}
function eval(alias, target) {
print alias "() { " target " \"${@}\"; }"
}
function output(name, type) {
print "↙ " type
print name
@ -24,14 +20,13 @@ function reset() {
BEGIN {
RE_ANY = "(.*)"
RE_BEGIN = "^"
RE_CONST = "([_A-Z][_0-9A-Z]*)"
RE_SET = "=.*"
RE_SPACE = "[[:space:]]"
RE_SPACES = RE_SPACE "*"
RE_VAR = "([_a-z][_0-9a-z]*)"
RE_SPACES = RE_SPACE "*"
RE_BEGIN = "^"
RE_END = RE_SPACES "$"
RE_FUNC = RE_SPACES "\\(" RE_SPACES "\\)" RE_SPACES "{"
@ -84,7 +79,7 @@ BEGIN {
} else if (match($0, RE_FUNCTION, m)) {
split(doc, array, "\n")
for (item in array) {
eval(array[item], m[1])
print array[item] " " m[1]
}
reset()
} else {

View file

@ -103,6 +103,21 @@ rwx_code_aliases() {
echo "${_rwx_code_aliases}"
}
# find alias function
rwx_code_alias_function() {
local target="${1}"
local line name
while IFS= read -r line; do
name="$(echo "${line}" | awk "{print \$1}")"
if [ "${name}" = "${target}" ]; then
echo "${line}" |
awk "{print \$2}"
fi
done <<EOF
${_rwx_code_aliases_functions}
EOF
}
# find command function
rwx_code_command_function() {
local target="${1}"
@ -189,7 +204,9 @@ rwx_code_load() {
# parse aliases functions
_rwx_code_aliases_functions="$(rwx_code_parse "aliases functions")"
while IFS= read -r line; do
eval "${line}"
text="$(echo "${line}" | sed "s| |() { |")"
text="${text} \"\${@}\"; }"
eval "${text}"
done <<EOF
${_rwx_code_aliases_functions}
EOF