Add --style argument bash completion

This commit is contained in:
Ville Skyttä 2022-09-10 10:33:13 +03:00 committed by David Peter
parent 46bf3c1e9a
commit c816188f97

View File

@ -54,7 +54,6 @@ _bat() {
--terminal-width | \
-m | --map-syntax | \
--ignored-suffix | \
--style | \
--list-themes | \
--line-range | \
-L | --list-languages | \
@ -96,6 +95,30 @@ _bat() {
compopt -o filenames # for escaping
return 0
;;
--style)
# shellcheck disable=SC2034
local -a styles=(
default
full
auto
plain
changes
header
header-filename
header-filesize
grid
rule
numbers
snip
)
# shellcheck disable=SC2016
if declare -F _comp_delimited >/dev/null 2>&1; then
# bash-completion > 2.11
_comp_delimited , -W '"${styles[@]}"'
else
COMPREPLY=($(compgen -W '${styles[@]}' -- "$cur"))
fi
return 0
esac
$split && return 0