SERVER-108058 fix zsh autocompletion detection in bazel wrapper (#39013)

GitOrigin-RevId: eb597e2878593f9cc83da14e93ddd1f765590a03
This commit is contained in:
Mathias Stearn 2025-07-24 17:09:49 -04:00 committed by MongoDB Bot
parent d4e114cbec
commit 334da0dfc0
1 changed files with 5 additions and 1 deletions

View File

@ -174,7 +174,11 @@ if [[ $* =~ ^.*--output_base=/tmp/.*-completion-$USER.*$ ]]; then
autocomplete_query=1
fi
# zsh autocomplete detection
if [[ $* == *"--noblock_for_lock query kind(\".*_test\", //:all)"* ]] || [[ $* == *"--noblock_for_lock query kind(\".*_test\", :all)"* ]]; then
# Note that this is a little weird because it is a regex that matches another regex.
# The gist is that it looks for ".*_test" or ".*_test|.*_binary" with :all or //:all
# Bash has odd quoting rules for the RHS of =~, which are avoided by using a variable.
zsh_autocomplete_regex='--noblock_for_lock query kind\("\.\*_test(\|\.\*_binary)?", (//)?:all\)'
if [[ $* =~ $zsh_autocomplete_regex ]]; then
autocomplete_query=1
fi