1
0
mirror of https://github.com/sharkdp/bat synced 2026-06-09 10:03:18 +00:00

fix(zsh): use newline-splitting for language completions to fix word-splitting on names with spaces

Language names like "HTML (Jinja2)" and "Apache Conf" contain spaces, which
caused $() command substitution to word-split them into garbage tokens. Use
${(f)"$(...)"}  (split on newlines only) to match the pattern already used
for theme completions on line 100.

Fixes #2897
This commit is contained in:
YoshKoz
2026-04-19 23:19:53 +02:00
committed by Keith Hall
parent 93c52a4f88
commit f39d63b85d
+1 -1
View File
@@ -90,7 +90,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
languages)
local IFS=$'\n'
local -a languages
languages=( $({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }') )
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }')"} )
_describe 'language' languages && ret=0
;;