Compare commits
No commits in common. "3b222fda83d315d9151644013cd86edb974f5f89" and "0926d058f554380bcf8290ff4f93d324678b076c" have entirely different histories.
3b222fda83
...
0926d058f5
3 changed files with 3 additions and 39 deletions
12
sh/code.awk
12
sh/code.awk
|
@ -85,18 +85,6 @@ BEGIN {
|
||||||
} else {
|
} else {
|
||||||
reset()
|
reset()
|
||||||
}
|
}
|
||||||
} else if (action == "commands functions") {
|
|
||||||
if (match($0, RE_COMMAND, m)) {
|
|
||||||
append(m[1])
|
|
||||||
} else if (match($0, RE_FUNCTION, m)) {
|
|
||||||
n = split(doc, array, "\n")
|
|
||||||
for (i = 1; i<= n; i++) {
|
|
||||||
print array[i] " " m[1]
|
|
||||||
}
|
|
||||||
reset()
|
|
||||||
} else {
|
|
||||||
reset()
|
|
||||||
}
|
|
||||||
} else if (action == "doc") {
|
} else if (action == "doc") {
|
||||||
# doc
|
# doc
|
||||||
if (match($0, RE_SHEBANG, m)) {
|
if (match($0, RE_SHEBANG, m)) {
|
||||||
|
|
27
sh/code.sh
27
sh/code.sh
|
@ -22,8 +22,6 @@ _rwx_code_aliases_functions=""
|
||||||
_rwx_code_binaries=""
|
_rwx_code_binaries=""
|
||||||
# cache for code commands
|
# cache for code commands
|
||||||
_rwx_code_commands=""
|
_rwx_code_commands=""
|
||||||
# cache for code commands functions
|
|
||||||
_rwx_code_commands_functions=""
|
|
||||||
# cache for code constants
|
# cache for code constants
|
||||||
_rwx_code_constants=""
|
_rwx_code_constants=""
|
||||||
# cache for code functions
|
# cache for code functions
|
||||||
|
@ -103,7 +101,7 @@ rwx_code_aliases() {
|
||||||
echo "${_rwx_code_aliases}"
|
echo "${_rwx_code_aliases}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# find alias function
|
# find aliased function
|
||||||
rwx_code_alias_function() {
|
rwx_code_alias_function() {
|
||||||
local target="${1}"
|
local target="${1}"
|
||||||
local line name
|
local line name
|
||||||
|
@ -118,21 +116,6 @@ ${_rwx_code_aliases_functions}
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
# find command function
|
|
||||||
rwx_code_command_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_commands_functions}
|
|
||||||
EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
# show the cached aliases and functions
|
# show the cached aliases and functions
|
||||||
#= rcaf
|
#= rcaf
|
||||||
rwx_code_aliases_functions() {
|
rwx_code_aliases_functions() {
|
||||||
|
@ -149,12 +132,6 @@ rwx_code_commands() {
|
||||||
echo "${_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
|
# show the cached constants
|
||||||
#= rcc
|
#= rcc
|
||||||
rwx_code_constants() {
|
rwx_code_constants() {
|
||||||
|
@ -254,7 +231,7 @@ rwx_code_main() {
|
||||||
if [ -n "${command}" ]; then
|
if [ -n "${command}" ]; then
|
||||||
local function
|
local function
|
||||||
# find the matching function
|
# find the matching function
|
||||||
function="$(rwx_code_command_function "${command}")"
|
function="$(rwx_code_alias_function "${command}")"
|
||||||
if [ -n "${function}" ]; then
|
if [ -n "${function}" ]; then
|
||||||
"${function}" "${@}"
|
"${function}" "${@}"
|
||||||
fi
|
fi
|
||||||
|
|
|
@ -22,8 +22,7 @@ rwx_test_code() {
|
||||||
"functions" \
|
"functions" \
|
||||||
"aliases" \
|
"aliases" \
|
||||||
"aliases_functions" \
|
"aliases_functions" \
|
||||||
"commands" \
|
"commands"
|
||||||
"commands_functions"
|
|
||||||
rwx_code
|
rwx_code
|
||||||
for items in "${@}"; do
|
for items in "${@}"; do
|
||||||
echo
|
echo
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue