aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorwr72024-02-23 15:46:41 +0000
committerGitHub2024-02-23 15:46:41 +0000
commit7100ed4efc2207a9d7a45ce6e9550564e091f508 (patch)
treec05ea69b8fe51e5fa6a45392bc53013278666fd2 /contrib
parentb7b6f300841bb61d8833fee1c58d0e3670849b61 (diff)
Properly handle spaces in filenames in bash autocomplete (#9702)
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/hx.bash11
1 files changed, 6 insertions, 5 deletions
diff --git a/contrib/completion/hx.bash b/contrib/completion/hx.bash
index 01b42deb..6ef0329e 100644
--- a/contrib/completion/hx.bash
+++ b/contrib/completion/hx.bash
@@ -5,19 +5,20 @@ _hx() {
# $1 command name
# $2 word being completed
# $3 word preceding
- COMPREPLY=()
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
-} && complete -o filenames -F _hx hx
+ local IFS=$'\n'
+ COMPREPLY=($COMPREPLY)
+} && complete -o filenames -F _hx hx