mirror of
https://github.com/robbyrussell/oh-my-zsh.git
synced 2025-12-06 23:40:39 +01:00
fix(alias-finder): early return on cmd len <2 (#13030)
This commit is contained in:
@@ -36,7 +36,11 @@ alias-finder() {
|
|||||||
# make filter to find only shorter results than current cmd
|
# make filter to find only shorter results than current cmd
|
||||||
if [[ $cheaper == true ]]; then
|
if [[ $cheaper == true ]]; then
|
||||||
cmdLen=$(echo -n "$cmd" | wc -c)
|
cmdLen=$(echo -n "$cmd" | wc -c)
|
||||||
filter="^'{0,1}.{0,$((cmdLen - 1))}="
|
if [[ $cmdLen -le 1 ]]; then
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
filter="^'?.{1,$((cmdLen - 1))}'?=" # some aliases is surrounded by single quotes
|
||||||
fi
|
fi
|
||||||
|
|
||||||
alias | grep -E "$filter" | grep -E "=$finder"
|
alias | grep -E "$filter" | grep -E "=$finder"
|
||||||
|
|||||||
Reference in New Issue
Block a user