This reverts commit 8174e02279. Turns out
it is needed for a common use case, see
https://github.com/sharkdp/bat/issues/2307.
It is not a clean revert, because I adjust CHANGELOG.md and also add a
comment to the test. I also had to resolve a small `use` conflict.
* Strip BOM from output in interactive mode
* Strip BOM when not loop_through, add regression tests
* Update CHANGELOG.md
* Only strip BOM from beginning of first line
* Fix integration test on macOS that relied on color scheme
* Fix integration test on Windows that relied on detected terminal width
* Fix syntax test that was failing due to a previously wrong (now fixed) highlighting
Co-authored-by: David Peter <mail@david-peter.de>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
We can't keep `syntect::parsing::SyntaxReference` as part of the public
API, because that might prevent us from bumping to syntect 6.0.0 without
also bumping bat to v2.0.0, once we reach v1.0.0.
So introduce a new stripped down struct `Syntax` and return that
instead. Let it be fully owned to make the API simple. It is not going
to be in a hot code path anyway.
I have looked at all code of our 27 dependents but I can't find a single
instance of this method being used, so this change should be safe for
v1.0.0.
* Make the default macOS theme depend on Dark Mode
We frequently get complaints from macOS users that bat does not work on
their default macOS terminal background, which is white.
Pay the price of slightly increased startup time to get a better default
on macOS. To avoid the slightly increased startup time, simply specify a
theme explicitly via `--theme`, `BAT_THEME`, or `~/.config/bat`.
Note that if there is an error when we check if Dark Mode is enabled, we
behave the same as on Windows and Linux; assume that the terminal
background is dark. This harmonizes behavior across platforms, and makes
bat behave the same as before, when Dark Mode was always assumed to be
enabled.
* src/assets.rs: Fix typo
* Update CHANGELOG.md
We need to type `inf` and `INF` as strings in `INI.sublime-syntax`,
otherwise `yaml-rust` interprets them as real numbers ("infinity") and
they do not get registered as file extensions:
/Users/martin/src/yaml-rust # https://github.com/chyh1990/yaml-rust
% cargo run --example dump_yaml ~/src/bat/assets/syntaxes/02_Extra/INI.sublime-syntax
---
String("name"):
String("INI")
String("file_extensions"):
String("ini")
String("INI")
Real("inf")
Real("INF")
...
Also add a regression test.
* Add a --style=default option
* Added --style=default test and CHANGELOG entry
* Format CHANGELOG.md options with quotes
Co-authored-by: Martin Nordholts <enselic@gmail.com>
* Update help text for '--style'
* Make --style=default the default option
* Update style descriptions: "basic" -> "recommended"
* Add integration test for --style=default as default
* Update clap long help for --style
There is now a new stage in the CICD workflow present, which will build
`bat` with the `BAT_SYSTEM_CONFIG_PREFIX` set to load the config file
from `/tests/examples/system_config/bat/config`, plus a basic set of
tests, to ensure the feature is working as expected. By default the
tests are set to ignored, as they need special setup before they can be
run.
* git global config - lookup $XDG_CONFIG_HOME faithfully
* Use `bool::then`
* Cover both `$XDG_CONFIG_HOME` & `$HOME/.config`
* Remove unused import
* Global git config tests
* Added trailing newline
* Fix git config test
* Wrote to changelog
* Revert change of `Result::ok` to `Result::unwrap`
* Apply suggestions from code review
Co-authored-by: Martin Nordholts <enselic@gmail.com>
* Guard against empty `$HOME`
Co-authored-by: Martin Nordholts <enselic@gmail.com>
I am setting up a new computer and thus are missing a lot of tools. I
noticed we rely on `jq` being installed, which is a bit annoying when it
is not installed yet.
We can quite easily get rid of this dependecy on `jq` by using a simple
`python3` oneliner.
* Bump assets/syntaxes/02_Extra/PowerShell from `4a0a076` to `742f0b5`
Bumps [assets/syntaxes/02_Extra/PowerShell](https://github.com/PowerShell/EditorSyntax) from `4a0a076` to `742f0b5`.
- [Release notes](https://github.com/PowerShell/EditorSyntax/releases)
- [Commits](4a0a076661...742f0b5d4b)
---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/PowerShell
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com>
* Do machine-conversion from .tmLanguage to .sublime-syntax
The new .sublime-syntax file is a pure "Tools" -> "Developer" -> "New Syntax
from ..." conversion from a licenced version of Sublime Text, Version 3.1.1,
Build 3176 with the .tmLanguage as the source file. No manual changes has been
made.
* Update regression test and add CHANGELOG.md entry
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
The text that is printed is generated when building assets, by analyzing LICENSE
and NOTICE files that comes with syntaxes and themes.
We take this opportunity to also add a NOTICE file as defined by Apache License 2.0.