From 3002a73cc176da0ec62192949fcf7e6023a19cd4 Mon Sep 17 00:00:00 2001 From: wr7 Date: Fri, 23 Feb 2024 10:26:12 -0600 Subject: [PATCH] Completely fix bash autocomplete handling of filenames with spaces Fix additional bug when file names contain spaces. ## Broken behavior - Assume the current directory contains the file "foo bar.txt" and "foo biz.txt" - `hx foo\ ba` + `Tab` autocompletes to `hx foo\ b` ## New behavior - `hx foo\ ba` + `Tab` autocompletes to `hx foo\ bar.txt` --- contrib/completion/hx.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contrib/completion/hx.bash b/contrib/completion/hx.bash index 6ef0329e49bd..62ca029bf738 100644 --- a/contrib/completion/hx.bash +++ b/contrib/completion/hx.bash @@ -8,14 +8,14 @@ _hx() { case "$3" in -g | --grammar) - COMPREPLY="$(compgen -W "fetch build" -- $2)" + COMPREPLY="$(compgen -W 'fetch build' -- $2)" ;; --health) local languages=$(hx --health |tail -n '+7' |awk '{print $1}' |sed 's/\x1b\[[0-9;]*m//g') - COMPREPLY="$(compgen -W "$languages" -- $2)" + COMPREPLY="$(compgen -W """$languages""" -- $2)" ;; *) - COMPREPLY="$(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- $2)" + COMPREPLY="$(compgen -fd -W "-h --help --tutor -V --version -v -vv -vvv --health -g --grammar --vsplit --hsplit -c --config --log" -- """$2""")" ;; esac