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

fix(zsh): drop redundant awk pipeline in language completion

`bat --list-languages` already emits each entry in `name:matchers`
form, which is the format `_describe` consumes directly. The previous
awk script split each line on `:` and re-emitted `$1:$2`, which is
byte-identical to the input.

Verified with `diff <(bat --list-languages) <(bat --list-languages |
awk -F: '{ printf("%s:%s\\n", $1, $2) }')` against the current
syntax set.
This commit is contained in:
truffle
2026-05-10 14:10:54 +00:00
parent 98df25434e
commit 138d70fd4c
+5 -5
View File
@@ -90,12 +90,12 @@ _{{PROJECT_EXECUTABLE}}_main() {
languages)
local IFS=$'\n'
local -a languages
# Only offer language names as completion values. The second column
# of `--list-languages` mixes plain extensions with globs (`*.rs`),
# absolute paths (`/etc/profile`), and full filenames
# (`Containerfile`); none of those parse as `-l` arguments. See
# `--list-languages` emits one `name:matchers` line per language,
# which `_describe` parses as `value:description`. Only the
# language name is offered as the completion value; the matchers
# show up as the menu description. See
# https://github.com/sharkdp/bat/issues/3735.
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-languages | awk -F: '{ printf("%s:%s\n", $1, $2) }')"} )
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-languages)"} )
_describe 'language' languages && ret=0
;;