code/aliases

This commit is contained in:
Marc Beninca 2025-07-07 02:10:05 +02:00
parent 6130f15fec
commit ec8b414018
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
4 changed files with 15 additions and 4 deletions

View file

@ -117,7 +117,6 @@ Two interpreted languages for flexibility.
* get unresolved path for new panes & windows
* fully working doc function algorithm
* self install aliases
* list aliases
* transfer all parsings to awk
### 6.2 [Further tasks](#when) {#when-further}

View file

@ -46,7 +46,11 @@ BEGIN {
}
{
if (action == "aliases functions") {
if (action == "aliases") {
if (match($0, RE_ALIAS, m)) {
print m[1]
}
} else if (action == "aliases functions") {
if (match($0, RE_ALIAS, m)) {
append(m[1])
} else if (match($0, RE_FUNCTION, m)) {

View file

@ -202,7 +202,9 @@ ${RWX_REGEX_BEGIN}\\(${RWX_REGEX_VARIABLE}\\)${RWX_REGEX_SET}"
_rwx_code_variables=""
rwx_parse_code() {
# parse aliases commands
# parse aliases
_rwx_code_aliases="$(rwx_parse_aliases)"
# parse aliases functions
local line text
_rwx_code_aliases_functions="$(rwx_parse_aliases_functions)"
while IFS= read -r line; do
@ -219,6 +221,12 @@ EOF
# parse variables
_rwx_code_variables="$(rwx_parse_variables)"
}
rwx_parse_aliases() {
echo "${_rwx_code}" |
awk \
--assign action="aliases" \
"$(rwx_code_awk)"
}
rwx_parse_aliases_functions() {
printf "%s" "${_rwx_code}" |
awk \

View file

@ -19,8 +19,8 @@ rwx_test_code() {
"constants" \
"variables" \
"functions" \
"aliases_functions" \
"aliases" \
"aliases_functions" \
rwx_code
for items in "${@}"; do