commands/functions
This commit is contained in:
parent
0926d058f5
commit
9b61976835
3 changed files with 38 additions and 2 deletions
25
sh/code.sh
25
sh/code.sh
|
@ -22,6 +22,8 @@ _rwx_code_aliases_functions=""
|
|||
_rwx_code_binaries=""
|
||||
# cache for code commands
|
||||
_rwx_code_commands=""
|
||||
# cache for code commands functions
|
||||
_rwx_code_commands_functions=""
|
||||
# cache for code constants
|
||||
_rwx_code_constants=""
|
||||
# cache for code functions
|
||||
|
@ -101,7 +103,7 @@ rwx_code_aliases() {
|
|||
echo "${_rwx_code_aliases}"
|
||||
}
|
||||
|
||||
# find aliased function
|
||||
# find alias function
|
||||
rwx_code_alias_function() {
|
||||
local target="${1}"
|
||||
local line name
|
||||
|
@ -116,6 +118,21 @@ ${_rwx_code_aliases_functions}
|
|||
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
|
||||
#= rcaf
|
||||
rwx_code_aliases_functions() {
|
||||
|
@ -132,6 +149,12 @@ 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() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue