Completely fix bash autocomplete handling of filenames with spaces (#9708)

This commit is contained in:
wr7 2024-02-23 20:54:40 -06:00 committed by GitHub
parent 03623f2f40
commit 38484f33e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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