Skip to content

bat language coloring detection seems to be case sensitive on Windows #2520

@SlyFoxHayes

Description

@SlyFoxHayes

I have a nuget config file, named NuGet.Config.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>
</configuration>

I also have the .config extension mapped to XML in my bat config file:
--map-syntax='*.config:XML'

With the command bat NuGet.Config, no coloring is displayed.
With the command bat NuGet.config, coloring is displayed.

If I rename the file so that the extension is lowercase (NuGet.config), the color/nocolor behavior is the same:

With the command bat NuGet.Config, no coloring is displayed.
With the command bat NuGet.config, coloring is displayed.

What steps will reproduce the bug?

  1. use bat to display a file where the extension is either not all lowercase, or not all lowercase was typed on the command line.

What happens?

The file is displayed without syntax coloring.

What did you expect to happen instead?

The file is displayed with syntax coloring.

How did you install bat?

chocolatey


bat version and environment

Software version

bat 0.22.1 (e5d9579)

Operating system

Windows 6.2.9200

Command-line

C:\ProgramData\chocolatey\lib\Bat\tools\bat-v0.22.1-x86_64-pc-windows-msvc\bat.exe NuGet.Config --diagnostic

Environment variables

SHELL=<not set>
PAGER=<not set>
LESS=<not set>
LANG=<not set>
LC_ALL=<not set>
BAT_PAGER="less -R -F"
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=x:\bin\bat.shconfig
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME="Solarized (dark)"
XDG_CONFIG_HOME=<not set>
XDG_CACHE_HOME=<not set>
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER=<not set>

System Config file

Could not read contents of 'C:\ProgramData\bat\config': The system cannot find the path specified. (os error 3).

Config file

# This is `bat`s configuration file. Each line either contains a comment or
# a command-line option that you want to pass to `bat` by default. You can
# run `bat --help` to get a list of all possible configuration options.

# Specify desired highlighting theme (e.g. "TwoDark"). Run `bat --list-themes`
# for a list of all available themes
## env BAT_THEME is used
##--theme='Solarized (dark)'

# Enable this to use italic text on the terminal. This is not supported on all
# terminal emulators (like tmux, by default):
--italic-text='always'

# Uncomment the following line to disable automatic paging: --paging=never

# Uncomment the following line if you are using less version >= 551 and want to
# enable mouse scrolling support in `bat` when running inside tmux. This might
# disable text selection, unless you press shift. #--pager="less --RAW-CONTROL-CHARS --quit-if-one-screen --mouse"
## env BAT_PAGER is used
##--pager "less -R -F"

# Syntax mappings: map a certain filename pattern to a language.
#   Example 1: use the C++ syntax for Arduino .ino files
#   Example 2: Use ".gitignore"-style highlighting for ".ignore" files
#--map-syntax "*.ino:C++"
--map-syntax '.ignore:Git Ignore'
--map-syntax '*.*ignore:Git Ignore'
--map-syntax '*.shconfig:Bourne Again Shell (bash)'
--map-syntax='*.conf:INI'
--map-syntax='*.config:XML'
--map-syntax='*.btm:Batch File'
## Visual Studio
--map-syntax='*.props:XML'
--map-syntax='*.targets:XML'
--map-syntax='*.csproj:XML'
--map-syntax='*.csproj.user:XML'
--map-syntax='*.vbproj:XML'
--map-syntax='*.vbproj.user:XML'
--map-syntax='*.vcxproj:XML'
--map-syntax='*.vcxproj.filters:XML'
--map-syntax='*.vcxproj.filters.user:XML'
## Data Comm
--map-syntax='*.soc:JSON'
--map-syntax='*.eipx:XML'


# https://github.com/sharkdp/bat
# https://github.com/sharkdp/bat/blob/master/doc/alternatives.md

### Integration with 4nt ###
# in 4start.btm, I documented the original aliases for 'list' and 'type'.
# both have been now aliased to use bat.
# There is no no difference between  'type' and 'list'

### Integration with code ###
# This file was made a .shconfig, for shell config.
# Generally, .config files are xml files, and code was complaining about formatting, and I always had to remap the syntax to shellscript
# Code now has a mapping for .shconfig to shell script.

Custom assets metadata

Could not read contents of 'C:\Users\thayes\AppData\Local\bat\metadata.yaml': The system cannot find the path specified. (os error 3).

Custom assets

'C:\Users\thayes\AppData\Local\bat' not found

Compile time information

  • Profile: release
  • Target triple: x86_64-pc-windows-msvc
  • Family: windows
  • OS: windows
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-pc-windows-msvc

Less version

> C:\ProgramData\chocolatey\bin\less.exe --version
less 608 (Spencer V8 regular expressions)
Copyright (C) 1984-2022  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions