Add custom theme/syntax detection to info.sh
_modules=('system' 'bat' 'bat_config' 'bat_wrapper' 'bat_wrapper_function' 'tool')
_modules_consented=()
+set -o pipefail
# -----------------------------------------------------------------------------
# Modules:
@@ -9,6 +10,7 @@ _modules_consented=()
_bat_:description() {
_collects "Version information for 'bat'."
+ _collects "Custom syntaxes and themes for 'bat'."
}
_bat_config_:description() {
@@ -39,6 +41,17 @@ _tool_:description() {
_bat_:run() {
_out bat --version
_out env | grep '^BAT_\|^PAGER='
+
+ local cache_dir="$(bat --cache-dir)"
+ if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
+ _print_command "bat" "--list-languages"
+ echo "Found custom syntax set."
+ fi
+
+ if [[ -f "${cache_dir}/themes.bin" ]]; then
+ _print_command "bat" "--list-themes"
+ echo "Found custom theme set."
+ fi
}
_bat_config_:run() {
