Re: [PATCH] bash-completion: don't add quoted space for ZSH (fix regression)
From: Matthieu Moy <hidden>
Date: 2016-06-15 22:52:48
Junio C Hamano [off-list ref] writes:
but is that the right thing to do if suffix came from "$4"? As far as I can see, "$4" is used to append "." in very limited cases, and nobody explicitly passes SP as "$4" when calling this, so it may be easier to read if you moved this before that "if we have 3 or more args, use the fourth one as the suffix" block, i.e. something like this?
Why not, but in case someone explicitely passes " " as $4 in the future, it's likely to be better to strip it for the same reason we strip it here. I don't care much either way in this case.
+ # Because we use '-o nospace' under bash, we need to compensate
+ # for it by appending SP after completed word ourselves.
+ local suffix="${BASH_VERSION+ }"Not sure why you reworded the comment, but I don't think it's a good idea to remove the "ZSH would quote the trailing space added with -S" that I had added, because this is really the reason we do a special case here. Your version is misleading, because we use -o nospace for ZSH too. So, overall, I prefer my version ;-). -- Matthieu Moy http://www-verimag.imag.fr/~moy/