The options --map-syntax and --ignored-suffix cannot work together.
Describe the bug you encountered:
The options --map-syntax and --ignored-suffix cannot work together.
How to reproduce it:
-
Prepare a file
foo.demoin YAML syntax:# file: foo.demo foo: "bar" -
Use
bat --map-syntax "*.demo:YAML" foo.democan print it with YAML syntax highlighting:bat foo.demo \ --map-syntax "*.demo:YAML" -
Copy
foo.demotofoo.demo.example, and usebat --map-syntax "*.demo:YAML" --ignored-suffix ".example" foo.demo.exampleCANNOT print it with YAML syntax highlighting:cp "foo.demo" "foo.demo.example" bat foo.demo.example \ --map-syntax "*.demo:YAML" \ --ignored-suffix ".example" # CANNOT print `foo.demo.example` with YAML syntax. -
BUT it works well If I only use
--ignored-suffix ".example"with built-in syntax mapping:# Use built-in syntax mapping (YAML): cp foo.demo.example foo.yaml.example bat foo.yaml.example \ --ignored-suffix ".example"
What did you expect to happen instead?
The options --map-syntax and --ignored-suffix can works togerher.
bat foo.demo.example \
--map-syntax "*.demo:YAML" \
--ignored-suffix ".example"
# I expect it can print `foo.demo.example` with YAML syntax.
How did you install bat?
Homebrew:
brew install --formula "bat"
bat version and environment
Software version
bat 0.20.0
Operating system
macOS 12.2 (Darwin 21.3.0)
Command-line
bat foo.demo.example --ignored-suffix .example --diagnostic
Environment variables
SHELL=/opt/homebrew/bin/bash
PAGER=<not set>
LESS='--no-init --quit-if-one-screen --ignore-case --status-column --LONG-PROMPT --RAW-CONTROL-CHARS --HILITE-UNREAD --tabs=4 --window=-6 '
LANG=en_US.UTF-8
LC_ALL=en_US.UTF-8
BAT_PAGER=<not set>
BAT_CACHE_PATH=<not set>
BAT_CONFIG_PATH=<not set>
BAT_OPTS=<not set>
BAT_STYLE=<not set>
BAT_TABS=<not set>
BAT_THEME=<not set>
XDG_CONFIG_HOME=~/.config
XDG_CACHE_HOME=~/.cache
COLORTERM=truecolor
NO_COLOR=<not set>
MANPAGER='sh -c '\''col -b -x | bat --language "man" --style "plain"'\'''
Config file
Could not read contents of '~/.config/bat/config': No such file or directory (os error 2).
Compile time information
- Profile: release
- Target triple: aarch64-apple-darwin
- Family: unix
- OS: macos
- Architecture: aarch64
- Pointer width: 64
- Endian: little
- CPU features: unknown
- Host: aarch64-apple-darwin
Less version
> less --version
less 590 (PCRE2 regular expressions)
Copyright (C) 1984-2021 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
thanks for this awesome tool.
Thank you for this bug report. I would hope that this is easy to fix.
Hi there 😃
I'd like to take this one, please
Hi there 😃
I'd like to take this one, please
Hi, sounds great! Please let us know if you have any questions or need any help :)
HI @keith-hall and thanks again to let me take it :)
I'm sorry, It was a pretty tough week at my job and I only had the time to check the issue this morning.
I'm gonna work on it today :)
As it is my first contribution, any advices to solve this one?
Shouldn't this issue be closed with #2260 ?
Yep, looks like it should. Fix released in bat v0.22.0. Sorry for not getting back to you with advice @LuisCardosoOliveira