zsh:funcs:suffix: Support quotes

Quotes need to be escaped, otherwise `(Q)` will not work on potential
uneven number of quotes.
This commit is contained in:
2022-06-03 15:40:45 +02:00
parent bf1eadbb79
commit 818ebdc144

View File

@@ -554,8 +554,8 @@ suffix() {
# starting point is passed to `find`, which then defaults to `.`. # starting point is passed to `find`, which then defaults to `.`.
local -a names local -a names
# Take everything before "--" # Take everything before "--" and quote special characters
names=( "${@:1:$((i-1))}" ) names=( "${(@q)@:1:$((i-1))}" )
# Prepend an `*` to every element and quote the result # Prepend an `*` to every element and quote the result
names=( "${(@)names//(#b)(*)/\"*$match\"}") names=( "${(@)names//(#b)(*)/\"*$match\"}")
# Join with " -o -name " and then split again using shell parsing # Join with " -o -name " and then split again using shell parsing