refactor(alias-finder): Simplify --longer option activation

This commit is contained in:
Roeniss Moon 2025-03-23 23:46:04 +09:00
parent d860c7548f
commit 3a746a7ee1
No known key found for this signature in database
GPG Key ID: 9E9AE088DBD537FB

View File

@ -24,9 +24,7 @@ alias-finder() {
## - add escaping character to special characters
cmd=$(echo -n "$cmd" | tr '\n' ' ' | xargs | tr -s '[:space:]' | sed 's/[].\|$(){}?+*^[]/\\&/g')
if [[ $longer == true ]]; then
wordEnd="" # remove wordEnd to find longer aliases
fi
$longer && wordEnd=".*$"
# find with alias and grep, removing last word each time until no more words
while [[ $cmd != "" ]]; do