code/aliases
This commit is contained in:
parent
6130f15fec
commit
ec8b414018
4 changed files with 15 additions and 4 deletions
|
@ -117,7 +117,6 @@ Two interpreted languages for flexibility.
|
||||||
* get unresolved path for new panes & windows
|
* get unresolved path for new panes & windows
|
||||||
* fully working doc function algorithm
|
* fully working doc function algorithm
|
||||||
* self install aliases
|
* self install aliases
|
||||||
* list aliases
|
|
||||||
* transfer all parsings to awk
|
* transfer all parsings to awk
|
||||||
|
|
||||||
### 6.2 [Further tasks](#when) {#when-further}
|
### 6.2 [Further tasks](#when) {#when-further}
|
||||||
|
|
|
@ -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)) {
|
if (match($0, RE_ALIAS, m)) {
|
||||||
append(m[1])
|
append(m[1])
|
||||||
} else if (match($0, RE_FUNCTION, m)) {
|
} else if (match($0, RE_FUNCTION, m)) {
|
||||||
|
|
10
sh/main.sh
10
sh/main.sh
|
@ -202,7 +202,9 @@ ${RWX_REGEX_BEGIN}\\(${RWX_REGEX_VARIABLE}\\)${RWX_REGEX_SET}"
|
||||||
_rwx_code_variables=""
|
_rwx_code_variables=""
|
||||||
|
|
||||||
rwx_parse_code() {
|
rwx_parse_code() {
|
||||||
# parse aliases commands
|
# parse aliases
|
||||||
|
_rwx_code_aliases="$(rwx_parse_aliases)"
|
||||||
|
# parse aliases functions
|
||||||
local line text
|
local line text
|
||||||
_rwx_code_aliases_functions="$(rwx_parse_aliases_functions)"
|
_rwx_code_aliases_functions="$(rwx_parse_aliases_functions)"
|
||||||
while IFS= read -r line; do
|
while IFS= read -r line; do
|
||||||
|
@ -219,6 +221,12 @@ EOF
|
||||||
# parse variables
|
# parse variables
|
||||||
_rwx_code_variables="$(rwx_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() {
|
rwx_parse_aliases_functions() {
|
||||||
printf "%s" "${_rwx_code}" |
|
printf "%s" "${_rwx_code}" |
|
||||||
awk \
|
awk \
|
||||||
|
|
|
@ -19,8 +19,8 @@ rwx_test_code() {
|
||||||
"constants" \
|
"constants" \
|
||||||
"variables" \
|
"variables" \
|
||||||
"functions" \
|
"functions" \
|
||||||
"aliases_functions" \
|
|
||||||
"aliases" \
|
"aliases" \
|
||||||
|
"aliases_functions" \
|
||||||
|
|
||||||
rwx_code
|
rwx_code
|
||||||
for items in "${@}"; do
|
for items in "${@}"; do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue