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

fix: pass --color=never --decorations=never in zsh completions

When BAT_OPTS contains --color=always or --decorations=always, the zsh
completion script's calls to --list-languages and --list-themes produce
ANSI escape codes that corrupt tab completion results.

Pass --color=never --decorations=never explicitly so completion output
is always plain text regardless of user config.

Fixes #3733
This commit is contained in:
June Kim
2026-05-09 03:35:54 -07:00
parent f57c1b6b1d
commit a0c95618c4
+3 -3
View File
@@ -90,20 +90,20 @@ _{{PROJECT_EXECUTABLE}}_main() {
languages) languages)
local IFS=$'\n' local IFS=$'\n'
local -a languages local -a languages
languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }')"} ) languages=( ${(f)"$({{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-languages | awk -F':|,' '{ for (i = 1; i <= NF; ++i) printf("%s:%s\n", $i, $1) }')"} )
_describe 'language' languages && ret=0 _describe 'language' languages && ret=0
;; ;;
themes) themes)
local -a themes expl local -a themes expl
themes=(${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --list-themes)"} ) themes=(${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-themes)"} )
_wanted themes expl 'theme' compadd -a themes && ret=0 _wanted themes expl 'theme' compadd -a themes && ret=0
;; ;;
theme_preferences) theme_preferences)
local -a themes expl local -a themes expl
themes=(auto dark light auto:always auto:system ${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --list-themes)"} ) themes=(auto dark light auto:always auto:system ${(f)"$(_call_program themes {{PROJECT_EXECUTABLE}} --color=never --decorations=never --list-themes)"} )
_wanted themes expl 'theme' compadd -a themes && ret=0 _wanted themes expl 'theme' compadd -a themes && ret=0
;; ;;