1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 10:52:24 +01:00

Compare commits

..

4 Commits

Author SHA1 Message Date
Keith Hall
6a6041c72c make further improvements to docs relating to sponsors 2022-02-09 22:41:59 +02:00
Keith Hall
0d93abde67 create separate sponsors.md file 2022-02-09 22:34:46 +02:00
Keith Hall
1cc39a790f improve sponsor section in readme 2022-02-09 22:26:12 +02:00
Keith Hall
2d93da1869 Add WorkOS sponsor to readme 2022-02-09 22:22:34 +02:00
67 changed files with 196 additions and 1278 deletions

View File

@@ -7,26 +7,9 @@ assignees: ''
--- ---
<!-- <!-- Hey there, thank you for creating an issue! -->
Hey there, thank you for reporting a bug! **Describe the bug you encountered:**
Please note that the following bugs have already been reported:
* dpkg: error processing archive /some/path/some-program.deb (--unpack):
trying to overwrite '/usr/.crates2.json'
See https://github.com/sharkdp/bat/issues/938
-->
**What steps will reproduce the bug?**
1. step 1
2. step 2
3. ...
**What happens?**
... ...

View File

@@ -7,5 +7,3 @@ assignees: ''
--- ---
<!-- Using a normal ticket is still fine, but feel free to ask your
questions about bat on https://github.com/sharkdp/bat/discussions instead. -->

View File

@@ -118,18 +118,6 @@ jobs:
toolchain: stable toolchain: stable
default: true default: true
profile: minimal profile: minimal
- name: Print -h
uses: actions-rs/cargo@v1
with:
command: run
args: --locked -- -h
- name: Print --help
uses: actions-rs/cargo@v1
with:
command: run
args: --locked -- --help
- name: Show man page
run: man $(find . -name bat.1)
- name: Check documentation - name: Check documentation
env: env:
RUSTDOCFLAGS: -D warnings RUSTDOCFLAGS: -D warnings
@@ -154,7 +142,7 @@ jobs:
- { target: x86_64-apple-darwin , os: macos-10.15 } - { target: x86_64-apple-darwin , os: macos-10.15 }
- { target: x86_64-pc-windows-gnu , os: windows-2019 } - { target: x86_64-pc-windows-gnu , os: windows-2019 }
- { target: x86_64-pc-windows-msvc , os: windows-2019 } - { target: x86_64-pc-windows-msvc , os: windows-2019 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04, use-cross: true } - { target: x86_64-unknown-linux-gnu , os: ubuntu-20.04 }
- { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true } - { target: x86_64-unknown-linux-musl , os: ubuntu-20.04, use-cross: true }
steps: steps:
- name: Checkout source code - name: Checkout source code

8
.gitmodules vendored
View File

@@ -236,11 +236,3 @@
[submodule "assets/syntaxes/02_Extra/Dart"] [submodule "assets/syntaxes/02_Extra/Dart"]
path = assets/syntaxes/02_Extra/Dart path = assets/syntaxes/02_Extra/Dart
url = https://github.com/elMuso/Dartlight.git url = https://github.com/elMuso/Dartlight.git
[submodule "assets/syntaxes/02_Extra/SublimeJQ"]
path = assets/syntaxes/02_Extra/SublimeJQ
url = https://github.com/zogwarg/SublimeJQ.git
[submodule "assets/syntaxes/02_Extra/cmd-help"]
path = assets/syntaxes/02_Extra/cmd-help
url = https://github.com/victor-gp/cmd-help-sublime-syntax.git
branch = main
shallow = true

View File

@@ -2,72 +2,11 @@
## Features ## Features
- Make the default macOS theme depend on Dark Mode. See #2197, #1746 (@Enselic)
## Bugfixes
## Other
- Relaxed glibc requirements on amd64, see #2106 and #2194 (@sharkdp)
## Syntaxes
## Themes
## `bat` as a library
# v0.21.0
## Features
- Correctly render tab stops in `--show-all`, see #2038 (@Synthetica9)
- Add a `--style=default` option and make it the default. It is less verbose than `full`, see #2061 (@IsaacHorvath)
- Enable BusyBox `less` as pager, see #2162 (@nfisher1226)
- File extensions are now matched case-insensitively. See #1854, #2181 (@Enselic)
## Bugfixes
- Bump `regex` dependency from 1.5.4 to 1.5.5 to fix [CVE-2022-24713](https://blog.rust-lang.org/2022/03/08/cve-2022-24713.html), see #2145, #2139 (@Enselic)
- `bat` no longer crashes when encountering files that references missing syntaxes. See #915, #2181 (@Enselic)
## Performance
- Skip syntax highlighting on long lines (> 16384 chars) to help improve performance. See #2165 (@keith-hall)
- Vastly improve startup time by lazy-loading syntaxes via syntect 5.0.0. This makes bat display small files ~75% faster than before. See #951, #2181 (@Enselic)
## Other
- Include info about custom assets in `--diagnostics` if used. See #2107, #2144 (@Enselic)
## Syntaxes
- Mapped clang-format config file (.clang-format) to YAML syntax (@TruncatedDinosour)
- log syntax: improved handling of escape characters in double quoted strings. See #2123 (@keith-hall)
- Associate `/var/spool/mail/*` and `/var/mail/*` with the `Email` syntax. See #2156 (@cyqsimon)
- Added cmd-help syntax to scope --help messages. See #2148 (@victor-gp)
- Slightly adjust Zig syntax. See #2136 (@Enselic)
- Associate `.inf` files with the `INI` syntax. See #2190 (@Enselic)
## `bat` as a library
- Allow configuration of `show_nonprintable` with `PrettyPrinter`, see #2142
- The binary format of syntaxes.bin has been changed due to syntaxes now being lazy-loaded via syntect 5.0.0. See #2181 (@Enselic)
- Mark `bat::error::Error` enum as `#[non_exhaustive]` to allow adding new variants without future semver breakage. See #2181 (@Enselic)
- Change `Error::SyntectError(syntect::LoadingError)` to `Error::SyntectError(syntect::Error)`. See #2181 (@Enselic)
- Add `Error::SyntectLoadingError(syntect::LoadingError)` enum variant. See #2181 (@Enselic)
# v0.20.0
## Features
- New style component `header-filesize` to show size of the displayed file in the header. See #1988 (@mdibaiee) - New style component `header-filesize` to show size of the displayed file in the header. See #1988 (@mdibaiee)
- Use underline for line highlighting on ANSI, see #1730 (@mdibaiee)
## Bugfixes ## Bugfixes
- Fix bash completion on bash 3.x and bash-completion 1.x. See #2066 (@joshpencheon) ## Other
## Syntaxes ## Syntaxes
@@ -75,14 +14,12 @@
- Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002 - Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002
- Associate `poetry.lock` files with the `TOML` syntax. See #2049 - Associate `poetry.lock` files with the `TOML` syntax. See #2049
- Associate `.mesh`, `.task`, `.rgen`, `.rint`, `.rahit`, `.rchit`, `.rmiss`, and `.rcall` with the `GLSL` syntax. See #2050 - Associate `.mesh`, `.task`, `.rgen`, `.rint`, `.rahit`, `.rchit`, `.rmiss`, and `.rcall` with the `GLSL` syntax. See #2050
- Added support for `JQ` syntax, see #2072
- Properly associate global git config files rooted in `$XDG_CONFIG_HOME/git/` or `$HOME/.config/git/`. See #2067 (@cyqsimon) ## Themes
## `bat` as a library ## `bat` as a library
- Exposed `get_syntax_set` and `get_theme` methods on `HighlightingAssets`. See #2030 (@dandavison) - Exposed `get_syntax_set` and `get_theme` methods on `HighlightingAssets`. See #2030 (@dandavison)
- Added `HeaderFilename` and `HeaderFilesize` to `StyleComponent` enum, and mark it `#[non_exhaustive]`. See #1988 (@mdibaiee)
# v0.19.0 # v0.19.0

View File

@@ -46,25 +46,3 @@ If you really think that a particular syntax or theme should be added for all
users, please read the corresponding users, please read the corresponding
[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md) [documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
first. first.
## Regression tests
You are strongly encouraged to add regression tests. Regression tests are great,
not least because they:
* ensure that your contribution will never completely stop working,
* makes code review easier, because it becomes very clear what the code is
supposed to do.
For functional changes, you most likely want to add a test to
[`tests/integration_tests.rs`](https://github.com/sharkdp/bat/blob/master/tests/integration_tests.rs).
Look at existing tests to know how to write a new test. In short, you will
invoke the `bat` binary with a certain set of arguments, and then assert on
stdout/stderr.
To learn how to write regression tests for theme and syntax changes, read the
[Syntax
tests](https://github.com/sharkdp/bat/blob/master/doc/assets.md#syntax-tests)
section in `assets.md`.

158
Cargo.lock generated
View File

@@ -74,7 +74,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]] [[package]]
name = "bat" name = "bat"
version = "0.21.0" version = "0.19.0"
dependencies = [ dependencies = [
"ansi_colours", "ansi_colours",
"ansi_term", "ansi_term",
@@ -98,7 +98,6 @@ dependencies = [
"path_abs", "path_abs",
"predicates", "predicates",
"regex", "regex",
"rlua",
"semver", "semver",
"serde", "serde",
"serde_yaml", "serde_yaml",
@@ -156,9 +155,9 @@ dependencies = [
[[package]] [[package]]
name = "bugreport" name = "bugreport"
version = "0.5.0" version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9" checksum = "0014b4b2b4f63bfe69c3838470121290cc437fdc79785d408a761a21e8b2404c"
dependencies = [ dependencies = [
"git-version", "git-version",
"shell-escape", "shell-escape",
@@ -383,9 +382,9 @@ dependencies = [
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.23" version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af" checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"crc32fast", "crc32fast",
@@ -453,9 +452,9 @@ dependencies = [
[[package]] [[package]]
name = "git2" name = "git2"
version = "0.14.2" version = "0.13.25"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c" checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"libc", "libc",
@@ -582,16 +581,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]] [[package]]
name = "libc" name = "lazycell"
version = "0.2.125" version = "1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5916d2ae698f6de9bfb891ad7a8d65c09d232dc58cc4ac433c7da3b2fd84bc2b" checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55"
[[package]]
name = "libc"
version = "0.2.112"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1b03d17f364a3a042d5e5d46b053bbbf82c92c9430c592dd4c064dc6ee997125"
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"
version = "0.13.2+1.4.2" version = "0.12.26+1.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b" checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
dependencies = [ dependencies = [
"cc", "cc",
"libc", "libc",
@@ -657,23 +662,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a" checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]] [[package]]
name = "miniz_oxide" name = "memoffset"
version = "0.5.1" version = "0.6.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d2b29bd4bc3f33391105ebee3589c19197c4271e3e5a9ec9bfe8127eeff8f082" checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce"
dependencies = [
"autocfg",
]
[[package]]
name = "miniz_oxide"
version = "0.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a92518e98c078586bc6c934028adcca4c92a53d6a958196de835170a01d84e4b"
dependencies = [ dependencies = [
"adler", "adler",
"autocfg",
] ]
[[package]] [[package]]
name = "nix" name = "nix"
version = "0.24.1" version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9" checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
dependencies = [ dependencies = [
"bitflags", "bitflags",
"cc",
"cfg-if", "cfg-if",
"libc", "libc",
"memoffset",
] ]
[[package]] [[package]]
@@ -693,9 +710,9 @@ dependencies = [
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.10.0" version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9" checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]] [[package]]
name = "onig" name = "onig"
@@ -781,9 +798,9 @@ dependencies = [
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "2.1.1" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c" checksum = "95e5a7689e456ab905c22c2b48225bb921aba7c8dfa58440d68ba13f6222a715"
dependencies = [ dependencies = [
"difflib", "difflib",
"float-cmp", "float-cmp",
@@ -809,30 +826,6 @@ dependencies = [
"termtree", "termtree",
] ]
[[package]]
name = "proc-macro-error"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
dependencies = [
"proc-macro-error-attr",
"proc-macro2",
"quote",
"syn",
"version_check",
]
[[package]]
name = "proc-macro-error-attr"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
dependencies = [
"proc-macro2",
"quote",
"version_check",
]
[[package]] [[package]]
name = "proc-macro-hack" name = "proc-macro-hack"
version = "0.5.19" version = "0.5.19"
@@ -878,9 +871,9 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.5.5" version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286" checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [ dependencies = [
"aho-corasick", "aho-corasick",
"memchr", "memchr",
@@ -917,36 +910,6 @@ dependencies = [
"bytemuck", "bytemuck",
] ]
[[package]]
name = "rlua"
version = "0.19.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "627ae78424400009e889c43b0c188d0b7af3fe7301b68c03d9cfacb29115408a"
dependencies = [
"bitflags",
"bstr",
"libc",
"num-traits",
"rlua-lua54-sys",
]
[[package]]
name = "rlua-lua54-sys"
version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b4e1fdfc6a5f7acfa1b1fe26c5076b54f5ebd6818b5982460c39844c8b859370"
dependencies = [
"cc",
"libc",
"pkg-config",
]
[[package]]
name = "rustversion"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.9" version = "1.0.9"
@@ -976,9 +939,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]] [[package]]
name = "semver" name = "semver"
version = "1.0.7" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4" checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
[[package]] [[package]]
name = "serde" name = "serde"
@@ -1025,9 +988,9 @@ dependencies = [
[[package]] [[package]]
name = "serial_test" name = "serial_test"
version = "0.6.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5bcc41d18f7a1d50525d080fd3e953be87c4f9f1a974f3c21798ca00d54ec15" checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
dependencies = [ dependencies = [
"lazy_static", "lazy_static",
"parking_lot", "parking_lot",
@@ -1036,14 +999,12 @@ dependencies = [
[[package]] [[package]]
name = "serial_test_derive" name = "serial_test_derive"
version = "0.6.0" version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2881bccd7d60fb32dfa3d7b3136385312f8ad75e2674aab2852867a09790cae8" checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
dependencies = [ dependencies = [
"proc-macro-error",
"proc-macro2", "proc-macro2",
"quote", "quote",
"rustversion",
"syn", "syn",
] ]
@@ -1055,9 +1016,9 @@ checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
[[package]] [[package]]
name = "shell-words" name = "shell-words"
version = "1.1.0" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074"
[[package]] [[package]]
name = "smallvec" name = "smallvec"
@@ -1090,9 +1051,9 @@ dependencies = [
[[package]] [[package]]
name = "syntect" name = "syntect"
version = "5.0.0" version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8" checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
dependencies = [ dependencies = [
"bincode", "bincode",
"bitflags", "bitflags",
@@ -1100,14 +1061,13 @@ dependencies = [
"flate2", "flate2",
"fnv", "fnv",
"lazy_static", "lazy_static",
"once_cell", "lazycell",
"onig", "onig",
"plist", "plist",
"regex-syntax", "regex-syntax",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",
"thiserror",
"walkdir", "walkdir",
"yaml-rust", "yaml-rust",
] ]
@@ -1183,18 +1143,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.31" version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a" checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.31" version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a" checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1277,12 +1237,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]] [[package]]
name = "wait-timeout" name = "wait-timeout"
version = "0.2.0" version = "0.2.0"

View File

@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
license = "MIT/Apache-2.0" license = "MIT/Apache-2.0"
name = "bat" name = "bat"
repository = "https://github.com/sharkdp/bat" repository = "https://github.com/sharkdp/bat"
version = "0.21.0" version = "0.19.0"
exclude = ["assets/syntaxes/*", "assets/themes/*"] exclude = ["assets/syntaxes/*", "assets/themes/*"]
build = "build.rs" build = "build.rs"
edition = '2018' edition = '2018'
@@ -30,11 +30,11 @@ minimal-application = [
"paging", "paging",
"regex-onig", "regex-onig",
"wild", "wild",
"rlua"
] ]
git = ["git2"] # Support indicating git modifications git = ["git2"] # Support indicating git modifications
paging = ["shell-words", "grep-cli"] # Support applying a pager on the output paging = ["shell-words", "grep-cli"] # Support applying a pager on the output
build-assets = ["syntect/yaml-load", "syntect/plist-load", "regex", "walkdir"] # Add "syntect/plist-load" when https://github.com/trishume/syntect/pull/345 reaches us
build-assets = ["syntect/yaml-load", "syntect/dump-create", "regex", "walkdir"]
# You need to use one of these if you depend on bat as a library: # You need to use one of these if you depend on bat as a library:
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
@@ -47,12 +47,12 @@ ansi_colours = "^1.1"
bincode = "1.0" bincode = "1.0"
console = "0.15.0" console = "0.15.0"
flate2 = "1.0" flate2 = "1.0"
once_cell = "1.10" once_cell = "1.9"
thiserror = "1.0" thiserror = "1.0"
wild = { version = "2.0", optional = true } wild = { version = "2.0", optional = true }
content_inspector = "0.2.4" content_inspector = "0.2.4"
encoding = "0.2" encoding = "0.2"
shell-words = { version = "1.1.0", optional = true } shell-words = { version = "1.0.0", optional = true }
unicode-width = "0.1.9" unicode-width = "0.1.9"
globset = "0.4" globset = "0.4"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
@@ -60,21 +60,20 @@ serde_yaml = "0.8"
semver = "1.0" semver = "1.0"
path_abs = { version = "0.5", default-features = false } path_abs = { version = "0.5", default-features = false }
clircle = "0.3" clircle = "0.3"
bugreport = { version = "0.5.0", optional = true } bugreport = { version = "0.4", optional = true }
dirs-next = { version = "2.0.0", optional = true } dirs-next = { version = "2.0.0", optional = true }
grep-cli = { version = "0.1.6", optional = true } grep-cli = { version = "0.1.6", optional = true }
regex = { version = "1.5.5", optional = true } regex = { version = "1.0", optional = true }
walkdir = { version = "2.0", optional = true } walkdir = { version = "2.0", optional = true }
bytesize = { version = "1.1.0" } bytesize = { version = "1.1.0" }
rlua = { version = "0.19", optional = true }
[dependencies.git2] [dependencies.git2]
version = "0.14" version = "0.13"
optional = true optional = true
default-features = false default-features = false
[dependencies.syntect] [dependencies.syntect]
version = "5.0.0" version = "4.6.0"
default-features = false default-features = false
features = ["parsing"] features = ["parsing"]
@@ -86,13 +85,13 @@ features = ["suggestions", "color", "wrap_help"]
[dev-dependencies] [dev-dependencies]
assert_cmd = "2.0.4" assert_cmd = "2.0.4"
serial_test = "0.6.0" serial_test = "0.5.1"
predicates = "2.1.1" predicates = "2.1.0"
wait-timeout = "0.2.0" wait-timeout = "0.2.0"
tempfile = "3.3.0" tempfile = "3.3.0"
[target.'cfg(unix)'.dev-dependencies] [target.'cfg(unix)'.dev-dependencies]
nix = { version = "0.24.1", default-features = false, features = ["term"] } nix = "0.23.1"
[build-dependencies] [build-dependencies]
clap = { version = "2.34", optional = true } clap = { version = "2.34", optional = true }

View File

@@ -21,7 +21,7 @@
### Sponsors ### Sponsors
A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br> a special thank you goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br>
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=bat&utm_source=github"> <a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=bat&utm_source=github">
<img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS"> <img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS">
<br> <br>
@@ -171,7 +171,7 @@ You can combine `bat` with `git diff` to view lines around code changes with pro
highlighting: highlighting:
```bash ```bash
batdiff() { batdiff() {
git diff --name-only --relative --diff-filter=d | xargs bat --diff git diff --name-only --diff-filter=d | xargs bat --diff
} }
``` ```
If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras). If you prefer to use this as a separate tool, check out `batdiff` in [`bat-extras`](https://github.com/eth-p/bat-extras).
@@ -212,24 +212,6 @@ Also, note that this will [not work](https://github.com/sharkdp/bat/issues/1145)
The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) script is a wrapper that will format code and print it with `bat`. The [`prettybat`](https://github.com/eth-p/bat-extras/blob/master/doc/prettybat.md) script is a wrapper that will format code and print it with `bat`.
#### Highlighting `--help` messages
You can use `bat` to colorize help text: `$ cp --help | bat -plhelp`
You can also use a wrapper around this:
```bash
# in your .bashrc/.zshrc/*rc
alias bathelp='bat --plain --language=help'
help() {
"$@" --help 2>&1 | bathelp
}
```
Then you can do `$ help cp` or `$ help git commit`.
Please report any issues with the help syntax in [this repository](https://github.com/victor-gp/cmd-help-sublime-syntax).
## Installation ## Installation

Binary file not shown.

View File

@@ -37,7 +37,7 @@ Register-ArgumentCompleter -Native -CommandName '{{PROJECT_EXECUTABLE}}' -Script
[CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').') [CompletionResult]::new('-m', 'm', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
[CompletionResult]::new('--map-syntax', 'map-syntax', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').') [CompletionResult]::new('--map-syntax', 'map-syntax', [CompletionResultType]::ParameterName, 'Use the specified syntax for files matching the glob pattern (''*.cpp:C++'').')
[CompletionResult]::new('--theme', 'theme', [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.') [CompletionResult]::new('--theme', 'theme', [CompletionResultType]::ParameterName, 'Set the color theme for syntax highlighting.')
[CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).') [CompletionResult]::new('--style', 'style', [CompletionResultType]::ParameterName, 'Comma-separated list of style elements to display (*auto*, full, plain, changes, header, grid, rule, numbers, snip).')
[CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.') [CompletionResult]::new('-r', 'r', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
[CompletionResult]::new('--line-range', 'line-range', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.') [CompletionResult]::new('--line-range', 'line-range', [CompletionResultType]::ParameterName, 'Only print the lines from N to M.')
[CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).') [CompletionResult]::new('-A', 'A', [CompletionResultType]::ParameterName, 'Show non-printable characters (space, tab, newline, ..).')

View File

@@ -2,22 +2,9 @@
# Requires https://github.com/scop/bash-completion # Requires https://github.com/scop/bash-completion
# Macs have bash3 for which the bash-completion package doesn't include
# _init_completion. This is a minimal version of that function.
__bat_init_completion()
{
COMPREPLY=()
_get_comp_words_by_ref "$@" cur prev words cword
}
_bat() { _bat() {
local cur prev words cword split=false local cur prev words cword split
if declare -F _init_completion >/dev/null 2>&1; then _init_completion -s || return 0
_init_completion -s || return 0
else
__bat_init_completion -n "=" || return 0
_split_longopt && split=true
fi
if [[ ${words[1]-} == cache ]]; then if [[ ${words[1]-} == cache ]]; then
case $prev in case $prev in

View File

@@ -56,7 +56,7 @@ complete -c {{PROJECT_EXECUTABLE}} -s P -d "Disable paging. Alias for '--paging=
complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache" complete -c {{PROJECT_EXECUTABLE}} -s A -l show-all -d "Show non-printable characters like space/tab/newline" -n "not __fish_seen_subcommand_from cache"
complete -c {{PROJECT_EXECUTABLE}} -l style -xka "default auto full plain changes header header-filename header-filesize grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache" complete -c {{PROJECT_EXECUTABLE}} -l style -xka "auto full plain changes header grid rule numbers snip" -d "Comma-separated list of style elements or presets to display with file contents" -n "not __fish_seen_subcommand_from cache"
complete -c {{PROJECT_EXECUTABLE}} -l tabs -x -d "<T> Set the tab width to T spaces (width of 0 passes tabs through directly)" -n "not __fish_seen_subcommand_from cache" complete -c {{PROJECT_EXECUTABLE}} -l tabs -x -d "<T> Set the tab width to T spaces (width of 0 passes tabs through directly)" -n "not __fish_seen_subcommand_from cache"

View File

@@ -75,7 +75,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
;; ;;
style) style)
_values -s , 'style' default auto full plain changes header header-filename header-filesize grid rule numbers snip _values -s , 'style' auto full plain changes header grid rule numbers snip
;; ;;
esac esac
} }

View File

@@ -146,8 +146,7 @@ Configure which elements (line numbers, file headers, grid borders, Git modifica
of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full'). of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
To set a default style, add the '\-\-style=".."' option to the configuration file or To set a default style, add the '\-\-style=".."' option to the configuration file or
export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid, values: *full*, auto, plain, changes, header, grid, rule, numbers, snip.
rule, numbers, snip.
.HP .HP
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>... \fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
.IP .IP

BIN
assets/syntaxes.bin vendored

Binary file not shown.

View File

@@ -5,8 +5,8 @@ name: INI
file_extensions: file_extensions:
- ini - ini
- INI - INI
- "inf" - inf
- "INF" - INF
- reg - reg
- REG - REG
- lng - lng

View File

@@ -6,7 +6,6 @@ file_extensions:
scope: text.log scope: text.log
variables: variables:
ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?) ipv4_part: (?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)
hours_minutes_seconds: (?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)
contexts: contexts:
main: main:
- match: (\w+)(=) - match: (\w+)(=)
@@ -18,10 +17,11 @@ contexts:
captures: captures:
1: punctuation.definition.string.begin.log 1: punctuation.definition.string.begin.log
3: punctuation.definition.string.end.log 3: punctuation.definition.string.end.log
- match: \" - match: (")([^"]*)(")
scope: string.quoted.double.log
captures: captures:
1: punctuation.definition.string.begin.log 1: punctuation.definition.string.begin.log
push: double_quoted_string 3: punctuation.definition.string.end.log
- include: dates - include: dates
- include: ip_addresses - include: ip_addresses
- include: numbers - include: numbers
@@ -29,34 +29,19 @@ contexts:
scope: markup.error.log scope: markup.error.log
- match: \b(?i:warn(?:ing)?)\b - match: \b(?i:warn(?:ing)?)\b
scope: markup.warning.log scope: markup.warning.log
- match: \b(?i:debug)\b
scope: markup.info.log
#- include: scope:text.html.markdown#autolink-inet #- include: scope:text.html.markdown#autolink-inet
- match: \b\w+:/{2,3} - match: \b\w+:/{2,3}
scope: markup.underline.link.scheme.log scope: markup.underline.link.scheme.log
push: url-host push: url-host
dates: dates:
- match: \b\d{4}-\d{2}-\d{2}(?=\b|T) - match: \b\d{4}-\d{2}-\d{2}\b
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
push: maybe_date_time_separator - match: \b\d{4}/\d{2}/\d{2}\b
- match: \b\d{4}/\d{2}/\d{2}(?=\b|T)
scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log scope: meta.date.log meta.number.integer.decimal.log constant.numeric.value.log
push: maybe_date_time_separator - match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
- match: \b(?={{hours_minutes_seconds}})
push: time
time:
- match: (?:{{hours_minutes_seconds}})(?:(\.)\d{3})?\b
scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
captures: captures:
1: punctuation.separator.decimal.log 1: punctuation.separator.decimal.log
- match: ''
pop: true
maybe_date_time_separator:
- match: T(?={{hours_minutes_seconds}})
scope: meta.date.log meta.time.log keyword.other.log
set: time
- match: ''
pop: true
ip_addresses: ip_addresses:
- match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b) - match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
push: push:
@@ -129,12 +114,3 @@ contexts:
scope: markup.underline.link.path.log scope: markup.underline.link.path.log
- match: '' - match: ''
pop: true pop: true
double_quoted_string:
- meta_scope: string.quoted.double.log
- match: \\"
scope: constant.character.escape.log
- match: \\n
scope: constant.character.escape.log
- match: \"
scope: punctuation.definition.string.end.log
pop: true

BIN
assets/themes.bin vendored

Binary file not shown.

View File

@@ -181,7 +181,7 @@ man 2 select
## インストール ## インストール
[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/bat.svg)](https://repology.org/project/bat/versions)
### On Ubuntu (`apt` を使用) ### On Ubuntu (`apt` を使用)
*... や他のDebianベースのLinuxディストリビューション* *... や他のDebianベースのLinuxディストリビューション*

View File

@@ -160,7 +160,7 @@ man 2 select
## Установка ## Установка
[![Packaging status](https://repology.org/badge/vertical-allrepos/bat-cat.svg)](https://repology.org/project/bat-cat/versions) [![Packaging status](https://repology.org/badge/vertical-allrepos/bat.svg)](https://repology.org/project/bat/versions)
### Ubuntu (с помощью `apt`) ### Ubuntu (с помощью `apt`)
*... и другие дистрибутивы основанные на Debian.* *... и другие дистрибутивы основанные на Debian.*

View File

@@ -1,5 +1,16 @@
# Release checklist # Release checklist
## Dependencies
See this page for a good overview: https://deps.rs/repo/github/sharkdp/bat
- [ ] Optional: update dependencies with `cargo update`. This is also done by
dependabot, so it is not strictly necessary.
- [ ] Install [cargo-outdated](https://crates.io/crates/cargo-outdated). Check
for outdated dependencies with `cargo outdated --root-deps-only` and
decide for each of them whether we want to (manually) upgrade. This will
require changes to `Cargo.toml`.
## Version bump ## Version bump
- [ ] Update version in `Cargo.toml`. Run `cargo build` to update `Cargo.lock`. - [ ] Update version in `Cargo.toml`. Run `cargo build` to update `Cargo.lock`.
@@ -7,22 +18,21 @@
- [ ] Find the current min. supported Rust version by running - [ ] Find the current min. supported Rust version by running
`grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`. `grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
- [ ] Update the version and the min. supported Rust version in `README.md` and - [ ] Update the version and the min. supported Rust version in `README.md` and
`doc/README-*.md`. Check with `doc/README-*.md`. Check with `git grep -i 'rust.*1\.'` and
`git grep -i -e 'rust.*1\.' -e '1\..*rust' | grep README | grep -v tests/`. `git grep -i '1\..*rust'`.
- [ ] Update `CHANGELOG.md`. Introduce a section for the new release. - [ ] Update `CHANGELOG.md`. Introduce a section for the new release.
## Update syntaxes and themes (build assets) ## Update syntaxes and themes (build assets)
- [ ] Install the latest master version (`cargo clean && cargo install --locked -f --path .`) and make - [ ] Install the latest master version (`cargo install -f --path .`) and make
sure that it is available on the `PATH` (`bat --version` should show the sure that it is available on the `PATH` (`bat --version` should show the
new version). new version).
- [ ] Run `assets/create.sh` and check in the binary asset files. - [ ] Run `assets/create.sh` and check in the binary asset files.
## Documentation ## Documentation
- [ ] Review `-h`, `--help`, and the `man` page. All of these are shown in - [ ] Review the `-h` and `--help` texts
the output of the CI job called *Documentation*, so look there. - [ ] Review the `man` page
The CI workflow corresponding to the tip of the master branch is a good place to look.
## Pre-release checks ## Pre-release checks
@@ -31,14 +41,13 @@
- [ ] Optional: manually test the new features and command-line options. To do - [ ] Optional: manually test the new features and command-line options. To do
this, install the latest `bat` version again (to include the new syntaxes this, install the latest `bat` version again (to include the new syntaxes
and themes). and themes).
- [ ] Run `cargo publish --dry-run` to make sure that it will - [ ] Run `cargo publish --dry-run --allow-dirty` to make sure that it will
succeed later (after creating the GitHub release). succeed later (after creating the GitHub release).
## Release ## Release
- [ ] Create a tag and push it: `git tag vX.Y.Z; git push origin tag vX.Y.Z`. - [ ] Create a tag and push it: `git tag vX.Y.Z; git push origin tag vX.Y.Z`.
This will trigger the deployment via GitHub Actions. This will trigger the deployment via GitHub Actions.
REMINDER: If your `origin` is a fork, don't forget to push to e.g. `upstream` instead!
- [ ] Go to https://github.com/sharkdp/bat/releases/new to create the new - [ ] Go to https://github.com/sharkdp/bat/releases/new to create the new
release. Select the new tag and also use it as the release title. For the release. Select the new tag and also use it as the release title. For the
release notes, copy the corresponding section from `CHANGELOG.md` and release notes, copy the corresponding section from `CHANGELOG.md` and
@@ -51,23 +60,4 @@
## Post-release ## Post-release
- [ ] Prepare a new "unreleased" section at the top of `CHANGELOG.md`. - [ ] Prepare a new (empty) "unreleased" section at the top of `CHANGELOG.md`.
Put this at the top:
```
# unreleased
## Features
## Bugfixes
## Other
## Syntaxes
## Themes
## `bat` as a library
```

View File

@@ -1,7 +1,5 @@
## Sponsors ## Sponsors
`bat` development is sponsored by many individuals and companies. Thank you very much!
Please note, that being sponsored does not affect the individuality of the `bat` Please note, that being sponsored does not affect the individuality of the `bat`
project or affect the maintainers' actions in any way. project or affect the maintainers' actions in any way.
We remain impartial and continue to assess pull requests solely on merit - the We remain impartial and continue to assess pull requests solely on merit - the

View File

@@ -1,21 +0,0 @@
function tempdir()
local stream = assert(io.popen('mktemp --directory'))
local output = stream:read('*all')
stream:close()
return string.gsub(output, "\n", "")
end
function preprocess(path_or_url)
filename_from_url = string.match(path_or_url, '^https?://.*/(.*)$')
if filename_from_url then
local temp_directory = tempdir()
local new_path = temp_directory .. "/" .. filename_from_url
-- TODO: how to prevent shell injection bugs?
os.execute("curl --silent '" .. path_or_url .. "' --output '" .. new_path .. "'")
return new_path
else
return path_or_url
end
end

View File

@@ -1,17 +0,0 @@
-- https://stackoverflow.com/a/3254007/704831
function is_dir(path)
local f = io.open(path, "r")
local ok, err, code = f:read(1)
f:close()
return code == 21
end
function preprocess(path)
if is_dir(path) then
tmpfile = os.tmpname()
os.execute("ls -alh --color=always '" .. path .. "' > '" .. tmpfile .. "'")
return tmpfile
else
return path
end
end

View File

@@ -1,21 +0,0 @@
-- Note: this plugin depends on the existence of 'inspect' [1] and 'hexyl' [2]
--
-- [1] https://github.com/sharkdp/content_inspector
-- [2] https://github.com/sharkdp/hexyl
function is_binary(path)
local stream = assert(io.popen("inspect '" .. path .. "'"))
local output = stream:read('*all')
stream:close()
return string.find(output, ": binary\n")
end
function preprocess(path)
if is_binary(path) then
tmpfile = os.tmpname()
os.execute("hexyl --length 1024 --no-position --border=none --no-squeezing '" .. path .. "' > '" .. tmpfile .. "'")
return tmpfile
else
return path
end
end

View File

@@ -1,21 +0,0 @@
function tempdir()
local stream = assert(io.popen('mktemp --directory'))
local output = stream:read('*all')
stream:close()
return string.gsub(output, "\n", "")
end
function preprocess(path)
prefix = string.match(path, '^(.*)%.gz$')
if prefix then
local temp_directory = tempdir()
local new_path = temp_directory .. "/" .. prefix
-- TODO: how to prevent shell injection bugs?
os.execute("gunzip < '" .. path .. "' > '" .. new_path .. "'")
return new_path
else
return path
end
end

View File

@@ -1 +0,0 @@
# Defaults are used

View File

@@ -43,9 +43,8 @@ pub struct SyntaxReferenceInSet<'a> {
pub syntax_set: &'a SyntaxSet, pub syntax_set: &'a SyntaxSet,
} }
/// Lazy-loaded syntaxes are already compressed, and we don't want to compress /// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
/// already compressed data. pub(crate) const COMPRESS_SYNTAXES: bool = true;
pub(crate) const COMPRESS_SYNTAXES: bool = false;
/// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes /// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes
/// within it are already compressed, and compressing another time just makes /// within it are already compressed, and compressing another time just makes
@@ -69,57 +68,10 @@ impl HighlightingAssets {
} }
} }
/// The default theme.
///
/// ### Windows and Linux
///
/// Windows and most Linux distributions has a dark terminal theme by
/// default. On these platforms, this function always returns a theme that
/// looks good on a dark background.
///
/// ### macOS
///
/// On macOS the default terminal background is light, but it is common that
/// Dark Mode is active, which makes the terminal background dark. On this
/// platform, the default theme depends on
/// ```bash
/// defaults read -globalDomain AppleInterfaceStyle
/// ````
/// To avoid the overhead of the check on macOS, simply specify a theme
/// explicitly via `--theme`, `BAT_THEME`, or `~/.config/bat`.
///
/// See <https://github.com/sharkdp/bat/issues/1746> and
/// <https://github.com/sharkdp/bat/issues/1928> for more context.
pub fn default_theme() -> &'static str { pub fn default_theme() -> &'static str {
#[cfg(not(target_os = "macos"))]
{
Self::default_dark_theme()
}
#[cfg(target_os = "macos")]
{
if macos_dark_mode_active() {
Self::default_dark_theme()
} else {
Self::default_light_theme()
}
}
}
/**
* The default theme that looks good on a dark background.
*/
fn default_dark_theme() -> &'static str {
"Monokai Extended" "Monokai Extended"
} }
/**
* The default theme that looks good on a light background.
*/
#[cfg(target_os = "macos")]
fn default_light_theme() -> &'static str {
"Monokai Extended Light"
}
pub fn from_cache(cache_path: &Path) -> Result<Self> { pub fn from_cache(cache_path: &Path) -> Result<Self> {
Ok(HighlightingAssets::new( Ok(HighlightingAssets::new(
SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")), SerializedSyntaxSet::FromFile(cache_path.join("syntaxes.bin")),
@@ -399,16 +351,6 @@ fn asset_from_cache<T: serde::de::DeserializeOwned>(
.map_err(|_| format!("Could not parse cached {}", description).into()) .map_err(|_| format!("Could not parse cached {}", description).into())
} }
#[cfg(target_os = "macos")]
fn macos_dark_mode_active() -> bool {
let mut defaults_cmd = std::process::Command::new("defaults");
defaults_cmd.args(&["read", "-globalDomain", "AppleInterfaceStyle"]);
match defaults_cmd.output() {
Ok(output) => output.stdout == b"Dark\n",
Err(_) => true,
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;
@@ -639,22 +581,13 @@ mod tests {
} }
#[test] #[test]
fn syntax_detection_is_case_insensitive() { fn syntax_detection_is_case_sensitive() {
let mut test = SyntaxDetectionTest::new(); let mut test = SyntaxDetectionTest::new();
assert_eq!(test.syntax_for_file("README.md"), "Markdown"); assert_ne!(test.syntax_for_file("README.MD"), "Markdown");
assert_eq!(test.syntax_for_file("README.mD"), "Markdown");
assert_eq!(test.syntax_for_file("README.Md"), "Markdown");
assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
// Adding a mapping for "MD" in addition to "md" should not break the mapping
test.syntax_mapping test.syntax_mapping
.insert("*.MD", MappingTarget::MapTo("Markdown")) .insert("*.MD", MappingTarget::MapTo("Markdown"))
.ok(); .ok();
assert_eq!(test.syntax_for_file("README.md"), "Markdown");
assert_eq!(test.syntax_for_file("README.mD"), "Markdown");
assert_eq!(test.syntax_for_file("README.Md"), "Markdown");
assert_eq!(test.syntax_for_file("README.MD"), "Markdown"); assert_eq!(test.syntax_for_file("README.MD"), "Markdown");
} }

View File

@@ -241,11 +241,6 @@ impl App {
.map(HighlightedLineRanges) .map(HighlightedLineRanges)
.unwrap_or_default(), .unwrap_or_default(),
use_custom_assets: !self.matches.is_present("no-custom-assets"), use_custom_assets: !self.matches.is_present("no-custom-assets"),
plugins: self
.matches
.values_of_os("load-plugin")
.unwrap_or_default()
.collect(),
}) })
} }
@@ -327,7 +322,7 @@ impl App {
.collect::<Vec<_>>() .collect::<Vec<_>>()
}) })
.or(env_style_components) .or(env_style_components)
.unwrap_or_else(|| vec![StyleComponent::Default]) .unwrap_or_else(|| vec![StyleComponent::Full])
.into_iter() .into_iter()
.map(|style| style.components(self.interactive_output)) .map(|style| style.components(self.interactive_output))
.fold(HashSet::new(), |mut acc, components| { .fold(HashSet::new(), |mut acc, components| {

View File

@@ -398,7 +398,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
!&[ !&[
"auto", "auto",
"full", "full",
"default",
"plain", "plain",
"header", "header",
"header-filename", "header-filename",
@@ -420,7 +419,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
}) })
.help( .help(
"Comma-separated list of style elements to display \ "Comma-separated list of style elements to display \
(*default*, auto, full, plain, changes, header, header-filename, header-filesize, grid, rule, numbers, snip).", (*auto*, full, plain, changes, header, grid, rule, numbers, snip).",
) )
.long_help( .long_help(
"Configure which elements (line numbers, file headers, grid \ "Configure which elements (line numbers, file headers, grid \
@@ -431,9 +430,8 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
'--style=\"..\"' option to the configuration file or export the \ '--style=\"..\"' option to the configuration file or export the \
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\ BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
Possible values:\n\n \ Possible values:\n\n \
* default: enables recommended style components (default).\n \ * full: enables all available components (default).\n \
* full: enables all available components.\n \ * auto: same as 'full', unless the output is piped.\n \
* auto: same as 'default', unless the output is piped.\n \
* plain: disables all available components.\n \ * plain: disables all available components.\n \
* changes: show Git modification markers.\n \ * changes: show Git modification markers.\n \
* header: alias for 'header-filename'.\n \ * header: alias for 'header-filename'.\n \
@@ -474,16 +472,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.help("Display all supported languages.") .help("Display all supported languages.")
.long_help("Display a list of supported languages for syntax highlighting."), .long_help("Display a list of supported languages for syntax highlighting."),
) )
.arg(
Arg::with_name("load-plugin")
.long("load-plugin")
.multiple(true)
.takes_value(true)
.number_of_values(1)
.value_name("name")
.help("Load plugin with specified name.")
.hidden_short_help(true)
)
.arg( .arg(
Arg::with_name("unbuffered") Arg::with_name("unbuffered")
.short("u") .short("u")

View File

@@ -91,7 +91,7 @@ pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseEr
.ok() .ok()
.map(|content| get_args_from_str(&content)) .map(|content| get_args_from_str(&content))
.transpose()? .transpose()?
.unwrap_or_default()) .unwrap_or_else(Vec::new))
} }
pub fn get_args_from_env_var() -> Option<Result<Vec<OsString>, shell_words::ParseError>> { pub fn get_args_from_env_var() -> Option<Result<Vec<OsString>, shell_words::ParseError>> {

View File

@@ -8,7 +8,6 @@ mod directories;
mod input; mod input;
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap, HashSet};
use std::ffi::OsStr;
use std::io; use std::io;
use std::io::{BufReader, Write}; use std::io::{BufReader, Write};
use std::path::Path; use std::path::Path;
@@ -219,66 +218,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
Ok(()) Ok(())
} }
fn load_and_run_preprocess_plugins(plugins: &[&OsStr], inputs: &mut Vec<Input>) -> Result<()> { fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
use bat::input::InputKind;
use rlua::{Function, Lua, Result as LuaResult};
use std::fs;
use std::path::PathBuf;
if plugins.is_empty() {
// Do not create Lua context if there are no plugins
return Ok(());
}
let lua = Lua::new();
for plugin_name in plugins {
// TODO: properly load plugins from a central directory + user directories
// TODO: how to handle plugin priority?
let mut plugin_path = PathBuf::from("plugins");
plugin_path.push(plugin_name);
let plugin_source_code = fs::read_to_string(&plugin_path).map_err(|e| {
format!(
"Could not load bat plugin '{}': {}",
plugin_path.to_string_lossy(),
e
)
})?;
lua.context::<_, LuaResult<()>>(|lua_ctx| {
let globals = lua_ctx.globals();
lua_ctx.load(&plugin_source_code).exec()?;
// Plugins are expected to have a 'preprocess' function
let preprocess: Function = globals.get("preprocess")?;
for input in inputs.iter_mut() {
if let InputKind::OrdinaryFile(ref mut path) = &mut input.kind {
let path_str: String = path.to_string_lossy().into();
let new_path = preprocess.call::<_, String>(path_str)?;
*path = PathBuf::from(new_path);
// TODO: the following line overwrites actual user provided names. However,
// this is necessary to get proper syntax highlighting for the path that
// is being provided by the plugin.
input.metadata.user_provided_name = Some(path.clone());
}
}
Ok(())
})
.map_err(|e| format!("Error while executing Lua code: {}", e))?;
}
Ok(())
}
fn run_controller(mut inputs: Vec<Input>, config: &Config) -> Result<bool> {
load_and_run_preprocess_plugins(&config.plugins, &mut inputs)?;
let assets = assets_from_cache_or_binary(config.use_custom_assets)?; let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
let controller = Controller::new(config, &assets); let controller = Controller::new(config, &assets);
controller.run(inputs) controller.run(inputs)
@@ -290,9 +230,6 @@ fn invoke_bugreport(app: &App) {
let pager = bat::config::get_pager_executable(app.matches.value_of("pager")) let pager = bat::config::get_pager_executable(app.matches.value_of("pager"))
.unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less". .unwrap_or_else(|| "less".to_owned()); // FIXME: Avoid non-canonical path to "less".
let mut custom_assets_metadata = PROJECT_DIRS.cache_dir().to_path_buf();
custom_assets_metadata.push("metadata.yaml");
let mut report = bugreport!() let mut report = bugreport!()
.info(SoftwareVersion::default()) .info(SoftwareVersion::default())
.info(OperatingSystem::default()) .info(OperatingSystem::default())
@@ -317,14 +254,6 @@ fn invoke_bugreport(app: &App) {
"MANPAGER", "MANPAGER",
])) ]))
.info(FileContent::new("Config file", config_file())) .info(FileContent::new("Config file", config_file()))
.info(FileContent::new(
"Custom assets metadata",
custom_assets_metadata,
))
.info(DirectoryEntries::new(
"Custom assets",
PROJECT_DIRS.cache_dir(),
))
.info(CompileTimeInformation::default()); .info(CompileTimeInformation::default());
#[cfg(feature = "paging")] #[cfg(feature = "paging")]

View File

@@ -5,8 +5,6 @@ use crate::style::StyleComponents;
use crate::syntax_mapping::SyntaxMapping; use crate::syntax_mapping::SyntaxMapping;
use crate::wrapping::WrappingMode; use crate::wrapping::WrappingMode;
use std::ffi::OsStr;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum VisibleLines { pub enum VisibleLines {
/// Show all lines which are included in the line ranges /// Show all lines which are included in the line ranges
@@ -88,9 +86,6 @@ pub struct Config<'a> {
/// Whether or not to allow custom assets. If this is false or if custom assets (a.k.a. /// Whether or not to allow custom assets. If this is false or if custom assets (a.k.a.
/// cached assets) are not available, assets from the binary will be used instead. /// cached assets) are not available, assets from the binary will be used instead.
pub use_custom_assets: bool, pub use_custom_assets: bool,
/// List of bat plugins to be loaded
pub plugins: Vec<&'a OsStr>,
} }
#[cfg(all(feature = "minimal-application", feature = "paging"))] #[cfg(all(feature = "minimal-application", feature = "paging"))]

View File

@@ -2,14 +2,11 @@ use std::io::Write;
use thiserror::Error; use thiserror::Error;
#[derive(Error, Debug)] #[derive(Error, Debug)]
#[non_exhaustive]
pub enum Error { pub enum Error {
#[error(transparent)] #[error(transparent)]
Io(#[from] ::std::io::Error), Io(#[from] ::std::io::Error),
#[error(transparent)] #[error(transparent)]
SyntectError(#[from] ::syntect::Error), SyntectError(#[from] ::syntect::LoadingError),
#[error(transparent)]
SyntectLoadingError(#[from] ::syntect::LoadingError),
#[error(transparent)] #[error(transparent)]
ParseIntError(#[from] ::std::num::ParseIntError), ParseIntError(#[from] ::std::num::ParseIntError),
#[error(transparent)] #[error(transparent)]

View File

@@ -69,8 +69,7 @@ impl InputDescription {
} }
} }
pub enum InputKind<'a> { pub(crate) enum InputKind<'a> {
// TODO
OrdinaryFile(PathBuf), OrdinaryFile(PathBuf),
StdIn, StdIn,
CustomReader(Box<dyn Read + 'a>), CustomReader(Box<dyn Read + 'a>),
@@ -87,15 +86,14 @@ impl<'a> InputKind<'a> {
} }
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub struct InputMetadata { pub(crate) struct InputMetadata {
// TODO pub(crate) user_provided_name: Option<PathBuf>,
pub user_provided_name: Option<PathBuf>,
pub(crate) size: Option<u64>, pub(crate) size: Option<u64>,
} }
pub struct Input<'a> { pub struct Input<'a> {
pub kind: InputKind<'a>, // TODO pub(crate) kind: InputKind<'a>,
pub metadata: InputMetadata, // TODO pub(crate) metadata: InputMetadata,
pub(crate) description: InputDescription, pub(crate) description: InputDescription,
} }
@@ -120,7 +118,7 @@ impl OpenedInput<'_> {
self.metadata self.metadata
.user_provided_name .user_provided_name
.as_ref() .as_ref()
.or(match self.kind { .or_else(|| match self.kind {
OpenedInputKind::OrdinaryFile(ref path) => Some(path), OpenedInputKind::OrdinaryFile(ref path) => Some(path),
_ => None, _ => None,
}) })

View File

@@ -3,38 +3,21 @@
use std::ffi::OsStr; use std::ffi::OsStr;
use std::process::Command; use std::process::Command;
#[derive(Debug, PartialEq)] pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
pub enum LessVersion {
Less(usize),
BusyBox,
}
pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<LessVersion> {
let resolved_path = grep_cli::resolve_binary(less_path.as_ref()).ok()?; let resolved_path = grep_cli::resolve_binary(less_path.as_ref()).ok()?;
let cmd = Command::new(resolved_path).arg("--version").output().ok()?; let cmd = Command::new(resolved_path).arg("--version").output().ok()?;
if cmd.status.success() { parse_less_version(&cmd.stdout)
parse_less_version(&cmd.stdout)
} else {
parse_less_version_busybox(&cmd.stderr)
}
} }
fn parse_less_version(output: &[u8]) -> Option<LessVersion> { fn parse_less_version(output: &[u8]) -> Option<usize> {
if !output.starts_with(b"less ") { if !output.starts_with(b"less ") {
return None; return None;
} }
let version = std::str::from_utf8(&output[5..]).ok()?; let version = std::str::from_utf8(&output[5..]).ok()?;
let end = version.find(|c: char| !c.is_ascii_digit())?; let end = version.find(|c: char| !c.is_ascii_digit())?;
Some(LessVersion::Less(version[..end].parse::<usize>().ok()?)) version[..end].parse::<usize>().ok()
}
fn parse_less_version_busybox(output: &[u8]) -> Option<LessVersion> {
match std::str::from_utf8(output) {
Ok(version) if version.contains("BusyBox ") => Some(LessVersion::BusyBox),
_ => None,
}
} }
#[test] #[test]
@@ -47,7 +30,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution. see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less"; Homepage: http://www.greenwoodsoftware.com/less";
assert_eq!(Some(LessVersion::Less(487)), parse_less_version(output)); assert_eq!(Some(487), parse_less_version(output));
} }
#[test] #[test]
@@ -60,7 +43,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution. see the file named README in the less distribution.
Homepage: http://www.greenwoodsoftware.com/less"; Homepage: http://www.greenwoodsoftware.com/less";
assert_eq!(Some(LessVersion::Less(529)), parse_less_version(output)); assert_eq!(Some(529), parse_less_version(output));
} }
#[test] #[test]
@@ -73,7 +56,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution. see the file named README in the less distribution.
Home page: http://www.greenwoodsoftware.com/less"; Home page: http://www.greenwoodsoftware.com/less";
assert_eq!(Some(LessVersion::Less(551)), parse_less_version(output)); assert_eq!(Some(551), parse_less_version(output));
} }
#[test] #[test]
@@ -86,7 +69,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution. see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less"; Home page: https://greenwoodsoftware.com/less";
assert_eq!(Some(LessVersion::Less(581)), parse_less_version(output)); assert_eq!(Some(581), parse_less_version(output));
} }
#[test] #[test]
@@ -94,38 +77,4 @@ fn test_parse_less_version_wrong_program() {
let output = b"more from util-linux 2.34"; let output = b"more from util-linux 2.34";
assert_eq!(None, parse_less_version(output)); assert_eq!(None, parse_less_version(output));
assert_eq!(None, parse_less_version_busybox(output));
}
#[test]
fn test_parse_less_version_busybox() {
let output = b"pkg/less: unrecognized option '--version'
BusyBox v1.35.0 (2022-04-21 10:38:11 EDT) multi-call binary.
Usage: less [-EFIMmNSRh~] [FILE]...
View FILE (or stdin) one screenful at a time
-E Quit once the end of a file is reached
-F Quit if entire file fits on first screen
-I Ignore case in all searches
-M,-m Display status line with line numbers
and percentage through the file
-N Prefix line number to each line
-S Truncate long lines
-R Remove color escape codes in input
-~ Suppress ~s displayed past EOF";
assert_eq!(
Some(LessVersion::BusyBox),
parse_less_version_busybox(output)
);
}
#[test]
fn test_parse_less_version_invalid_utf_8() {
let output = b"\xff";
assert_eq!(None, parse_less_version(output));
assert_eq!(None, parse_less_version_busybox(output));
} }

View File

@@ -4,7 +4,7 @@ use std::process::Child;
use crate::error::*; use crate::error::*;
#[cfg(feature = "paging")] #[cfg(feature = "paging")]
use crate::less::{retrieve_less_version, LessVersion}; use crate::less::retrieve_less_version;
#[cfg(feature = "paging")] #[cfg(feature = "paging")]
use crate::paging::PagingMode; use crate::paging::PagingMode;
#[cfg(feature = "paging")] #[cfg(feature = "paging")]
@@ -83,13 +83,13 @@ impl OutputType {
let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager; let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager;
if args.is_empty() || replace_arguments_to_less { if args.is_empty() || replace_arguments_to_less {
p.arg("-R"); // Short version of --RAW-CONTROL-CHARS for maximum compatibility p.arg("--RAW-CONTROL-CHARS");
if single_screen_action == SingleScreenAction::Quit { if single_screen_action == SingleScreenAction::Quit {
p.arg("-F"); // Short version of --quit-if-one-screen for compatibility p.arg("--quit-if-one-screen");
} }
if wrapping_mode == WrappingMode::NoWrapping(true) { if wrapping_mode == WrappingMode::NoWrapping(true) {
p.arg("-S"); // Short version of --chop-long-lines for compatibility p.arg("--chop-long-lines");
} }
// Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older // Passing '--no-init' fixes a bug with '--quit-if-one-screen' in older
@@ -103,9 +103,7 @@ impl OutputType {
None => { None => {
p.arg("--no-init"); p.arg("--no-init");
} }
Some(LessVersion::Less(version)) Some(version) if (version < 530 || (cfg!(windows) && version < 558)) => {
if (version < 530 || (cfg!(windows) && version < 558)) =>
{
p.arg("--no-init"); p.arg("--no-init");
} }
_ => {} _ => {}

View File

@@ -53,33 +53,26 @@ pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
let tab_width = if tab_width == 0 { 4 } else { tab_width }; let tab_width = if tab_width == 0 { 4 } else { tab_width };
let mut idx = 0; let mut idx = 0;
let mut line_idx = 0;
let len = input.len(); let len = input.len();
while idx < len { while idx < len {
if let Some((chr, skip_ahead)) = try_parse_utf8_char(&input[idx..]) { if let Some((chr, skip_ahead)) = try_parse_utf8_char(&input[idx..]) {
idx += skip_ahead; idx += skip_ahead;
line_idx += 1;
match chr { match chr {
// space // space
' ' => output.push('·'), ' ' => output.push('·'),
// tab // tab
'\t' => { '\t' => {
let tab_stop = tab_width - ((line_idx - 1) % tab_width); if tab_width == 1 {
line_idx = 0;
if tab_stop == 1 {
output.push('↹'); output.push('↹');
} else { } else {
output.push('├'); output.push('├');
output.push_str(&"".repeat(tab_stop - 2)); output.push_str(&"".repeat(tab_width - 2));
output.push('┤'); output.push('┤');
} }
} }
// line feed // line feed
'\x0A' => { '\x0A' => output.push_str("\x0A"),
output.push_str("\x0A");
line_idx = 0;
}
// carriage return // carriage return
'\x0D' => output.push('␍'), '\x0D' => output.push('␍'),
// null // null

View File

@@ -164,12 +164,6 @@ impl<'a> PrettyPrinter<'a> {
self self
} }
/// Whether to print binary content or nonprintable characters (default: no)
pub fn show_nonprintable(&mut self, yes: bool) -> &mut Self {
self.config.show_nonprintable = yes;
self
}
/// Whether to show "snip" markers between visible line ranges (default: no) /// Whether to show "snip" markers between visible line ranges (default: no)
pub fn snip(&mut self, yes: bool) -> &mut Self { pub fn snip(&mut self, yes: bool) -> &mut Self {
self.active_style_components.snip = yes; self.active_style_components.snip = yes;

View File

@@ -445,21 +445,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
return Ok(()); return Ok(());
} }
}; };
highlighter_from_set
// skip syntax highlighting on long lines
let too_long = line.len() > 1024 * 16;
let for_highlighting: &str = if too_long { "\n" } else { &line };
let mut highlighted_line = highlighter_from_set
.highlighter .highlighter
.highlight_line(for_highlighting, highlighter_from_set.syntax_set)?; .highlight(&line, highlighter_from_set.syntax_set)
if too_long {
highlighted_line[0].1 = &line;
}
highlighted_line
}; };
if out_of_range { if out_of_range {
@@ -475,10 +463,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
let highlight_this_line = let highlight_this_line =
self.config.highlighted_lines.0.check(line_number) == RangeCheckResult::InRange; self.config.highlighted_lines.0.check(line_number) == RangeCheckResult::InRange;
if highlight_this_line && self.config.theme == "ansi" {
self.ansi_style.update("^[4m");
}
let background_color = self let background_color = self
.background_color_highlight .background_color_highlight
.filter(|_| highlight_this_line); .filter(|_| highlight_this_line);
@@ -665,11 +649,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
writeln!(handle)?; writeln!(handle)?;
} }
if highlight_this_line && self.config.theme == "ansi" {
self.ansi_style.update("^[24m");
write!(handle, "\x1B[24m")?;
}
Ok(()) Ok(())
} }
} }

View File

@@ -17,7 +17,6 @@ pub enum StyleComponent {
LineNumbers, LineNumbers,
Snip, Snip,
Full, Full,
Default,
Plain, Plain,
} }
@@ -26,7 +25,7 @@ impl StyleComponent {
match self { match self {
StyleComponent::Auto => { StyleComponent::Auto => {
if interactive_terminal { if interactive_terminal {
StyleComponent::Default.components(interactive_terminal) StyleComponent::Full.components(interactive_terminal)
} else { } else {
StyleComponent::Plain.components(interactive_terminal) StyleComponent::Plain.components(interactive_terminal)
} }
@@ -49,14 +48,6 @@ impl StyleComponent {
StyleComponent::LineNumbers, StyleComponent::LineNumbers,
StyleComponent::Snip, StyleComponent::Snip,
], ],
StyleComponent::Default => &[
#[cfg(feature = "git")]
StyleComponent::Changes,
StyleComponent::Grid,
StyleComponent::HeaderFilename,
StyleComponent::LineNumbers,
StyleComponent::Snip,
],
StyleComponent::Plain => &[], StyleComponent::Plain => &[],
} }
} }
@@ -78,7 +69,6 @@ impl FromStr for StyleComponent {
"numbers" => Ok(StyleComponent::LineNumbers), "numbers" => Ok(StyleComponent::LineNumbers),
"snip" => Ok(StyleComponent::Snip), "snip" => Ok(StyleComponent::Snip),
"full" => Ok(StyleComponent::Full), "full" => Ok(StyleComponent::Full),
"default" => Ok(StyleComponent::Default),
"plain" => Ok(StyleComponent::Plain), "plain" => Ok(StyleComponent::Plain),
_ => Err(format!("Unknown style '{}'", s).into()), _ => Err(format!("Unknown style '{}'", s).into()),
} }

View File

@@ -41,9 +41,6 @@ impl<'a> SyntaxMapping<'a> {
pub fn builtin() -> SyntaxMapping<'a> { pub fn builtin() -> SyntaxMapping<'a> {
let mut mapping = Self::empty(); let mut mapping = Self::empty();
mapping.insert("*.h", MappingTarget::MapTo("C++")).unwrap(); mapping.insert("*.h", MappingTarget::MapTo("C++")).unwrap();
mapping
.insert(".clang-format", MappingTarget::MapTo("YAML"))
.unwrap();
mapping.insert("*.fs", MappingTarget::MapTo("F#")).unwrap(); mapping.insert("*.fs", MappingTarget::MapTo("F#")).unwrap();
mapping mapping
.insert("build", MappingTarget::MapToUnknown) .insert("build", MappingTarget::MapToUnknown)
@@ -120,32 +117,13 @@ impl<'a> SyntaxMapping<'a> {
mapping.insert(glob, MappingTarget::MapTo("INI")).unwrap(); mapping.insert(glob, MappingTarget::MapTo("INI")).unwrap();
} }
// unix mail spool
for glob in &["/var/spool/mail/*", "/var/mail/*"] {
mapping.insert(glob, MappingTarget::MapTo("Email")).unwrap()
}
// pacman hooks // pacman hooks
mapping mapping
.insert("*.hook", MappingTarget::MapTo("INI")) .insert("*.hook", MappingTarget::MapTo("INI"))
.unwrap(); .unwrap();
// Global git config files rooted in `$XDG_CONFIG_HOME/git/` or `$HOME/.config/git/` if let Some(xdg_config_home) = std::env::var_os("XDG_CONFIG_HOME") {
// See e.g. https://git-scm.com/docs/git-config#FILES let git_config_path = Path::new(&xdg_config_home).join("git");
if let Some(xdg_config_home) =
std::env::var_os("XDG_CONFIG_HOME").filter(|val| !val.is_empty())
{
insert_git_config_global(&mut mapping, &xdg_config_home);
}
if let Some(default_config_home) = std::env::var_os("HOME")
.filter(|val| !val.is_empty())
.map(|home| Path::new(&home).join(".config"))
{
insert_git_config_global(&mut mapping, &default_config_home);
}
fn insert_git_config_global(mapping: &mut SyntaxMapping, config_home: impl AsRef<Path>) {
let git_config_path = config_home.as_ref().join("git");
mapping mapping
.insert( .insert(

View File

@@ -1,3 +0,0 @@
[user]
email = foo@bar.net
name = foobar

View File

@@ -1,3 +0,0 @@
[user]
email = foo@bar.net
name = foobar

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +0,0 @@
[section]
key=value
# This file is just for testing that the INI syntax is registered to handle
# the .inf file extension, it is not testing the syntax highlighting capabilities
# of the INI syntax itself

View File

@@ -1,60 +0,0 @@
import "../imported-file" ;
# With Comments !
def weird($a; $b; $c):
 [ $a, $b, $c ] | transpose | reduce .[][] as $item (
 [];
 . + $item.property
 )
;
. | weird (.a; .b; .c) |
(
if (. | contains("never") ) then
 "Why yes"
else
 12.23
end
) as $never |
{
 hello,
 why: "because",
 hello: ( weird | ascii_upcase ),
 format_eg: ( . | @json "My json string \( . | this | part | just | white | ascii_upcase | transpose)" ),
 never: $never,
 "literal_key": literal_value,
 "this": 12.1e12,
 "part": "almost"
 "like": [
 12,
 2
 "json"
 {
 "quite": {
 similar: "but not quite"
 }
 }
 ],
} | (
 
 # And with very basic brace matching
 
 # Invalid End
 ] 
 
 # Other invalid ends
 ( [ } ] )
 # A "valid" sequence
 ( [ { key: () , other_key:( [ [] [[]] ] ), gaga } ] )
 # A "invalid" sequence
 ( [ { key: () , other_key:( [ [] [[] ] ), gaga } ] )
 "A string\n whith escaped characters \" because we can"
)

View File

@@ -1,3 +1,2 @@
2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html 2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html
2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html 2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html
2022-03-16T17:41:02.519 helix_term::application [WARN] unhandled window/showMessage: ShowMessageParams { typ: Error, message: "rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/zeta/dev/raytracer/Cargo.toml, cargo 1.61.0-nightly (65c8266 2022-03-09): Failed to run `\"cargo\" \"metadata\" \"--format-version\" \"1\" \"--manifest-path\" \"/home/zeta/dev/raytracer/Cargo.toml\" \"--filter-platform\" \"wasm32-unknown-unknown\"`: `cargo metadata` exited with an error: Updating crates.io index\nerror: failed to select a version for `parking_lot`.\n ... required by package `raytracer v0.1.0 (/home/zeta/dev/raytracer)`\nversions that meet the requirements `^0.12.0` are: 0.12.0\n\nthe package `raytracer` depends on `parking_lot`, with features: `wasm-bindgen` but `parking_lot` does not have these features.\n\n\nfailed to select a version for `parking_lot` which could resolve this conflict\n" }

View File

@@ -27,13 +27,9 @@
</script> </script>
<script type="text/livescript"> <script type="text/livescript">
 // This block is a regression test for a bat panic when a LiveScript syntax definition is missing  // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
</script> </script>
<style lang="text/postcss">
 /* This block is a regression test for a bat panic when a PostCSS syntax definition is missing */
</style>
<style> <style>
 main {  main {
 position: relative;  position: relative;

View File

@@ -1,7 +1,7 @@
Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded. Apr 4 00:00:01 hostname-here systemd[1]: logrotate.service: Succeeded.
Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files. Apr 4 00:00:01 hostname-here systemd[1]: Finished Rotate log files.
Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available Apr 4 00:00:01 hostname-here colord[920]: failed to get session [pid 137485]: No data available
Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice" Apr 4 00:00:21 hostname-here kernel: [55604.908232] audit: type=1400 audit(1617483621.094:28): apparmor="DENIED" operation="capable" profile="/usr/sbin/cups-browsed" pid=59311 comm="cups-browsed" capability=23 capname="sys_nice"
Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP. Apr 4 00:01:38 hostname-here systemd-resolved[721]: Server returned error NXDOMAIN, mitigating potential DNS violation DVE-2018-0001, retrying transaction with reduced feature level UDP.
Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37 Apr 4 00:04:46 hostname-here ntpd[952]: Soliciting pool server 255.76.59.37
Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 -> <null> Apr 4 00:05:21 hostname-here ntpd[952]: ::1 local addr 0:0:0:0:0:0:0:1 -> <null>
@@ -10,7 +10,7 @@
Apr 4 16:32:07 hostname-here NetworkManager[740]: <info> [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL Apr 4 16:32:07 hostname-here NetworkManager[740]: <info> [1617629527.1101] manager: NetworkManager state is now CONNECTED_GLOBAL
Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid' Apr 4 22:00:45 hostname-here dbus-daemon[1094]: [session uid=1000 pid=1094] Successfully activated service 'io.github.celluloid_player.Celluloid'
Aug 11 13:29:06 hostname-here insomnia_insomnia.desktop[142666]: 13:29:06.316 [updater] Updater not running platform=linux dev=false Aug 11 13:29:06 hostname-here insomnia_insomnia.desktop[142666]: 13:29:06.316 [updater] Updater not running platform=linux dev=false
Aug 11 13:36:34 192.168.220.5 nginx: 2021/08/11 13:36:34 [debug] 2031#2031: epoll add event: fd:6 op:1 ev:00002001 Aug 11 13:36:34 192.168.220.5 nginx: 2021/08/11 13:36:34 [debug] 2031#2031: epoll add event: fd:6 op:1 ev:00002001
Aug 11 21:31:08 ::1 nginx: 2021/08/11 21:31:08 [debug] 760831#760831: epoll add event: fd:6 op:1 ev:10000001 Aug 11 21:31:08 ::1 nginx: 2021/08/11 21:31:08 [debug] 760831#760831: epoll add event: fd:6 op:1 ev:10000001
Aug 11 21:40:31 hostname-here scop hello Aug 11 21:40:31 hostname-here scop hello
Aug 16 21:38:21 hostname-here systemd[1]: Finished Cleanup of Temporary Directories. Aug 16 21:38:21 hostname-here systemd[1]: Finished Cleanup of Temporary Directories.

View File

@@ -8,11 +8,6 @@
 </div>  </div>
</template> </template>
<template lang='pug'>
 #container.col
 p This shall be formatted as Plain Text as long as a Pug syntax definition is missing
</template>
<script> <script>
import AppHeader from "@/components/AppHeader"; import AppHeader from "@/components/AppHeader";
import AppLoadingIndicator from "@/components/AppLoadingIndicator"; import AppLoadingIndicator from "@/components/AppLoadingIndicator";

View File

@@ -1,18 +1,18 @@
//! this is a top level doc, starts with "//!" //! this is a top level doc, starts with "//!"
const std = @import("std"); const std = @import("std");
pub fn main() anyerror!void { pub fn main() anyerror!void {
 const stdout = std.io.getStdOut().writer();  const stdout = std.io.getStdOut().writer();
 try stdout.print("Hello, {}!\n", .{"world"});  try stdout.print("Hello, {}!\n", .{"world"});
} }
const expect = std.testing.expect; const expect = std.testing.expect;
test "comments" { test "comments" {
 // comments start with "//" until newline  // comments start with "//" until newline
 // foo bar baz  // foo bar baz
 const x = true; // another comment  const x = true; // another comment
 expect(x);  expect(x);
} }
@@ -25,26 +25,26 @@
 /// number of nanoseconds past the second  /// number of nanoseconds past the second
 nano: u32,  nano: u32,
 const Self = @This();  const Self = @This();
 pub fn unixEpoch() Self {  pub fn unixEpoch() Self {
 return Self{  return Self{
 .seconds = 0,  .seconds = 0,
 .nanos = 0,  .nanos = 0,
 };  };
 }  }
}; };
const my_val = switch (std.Target.current.os.tag) { const my_val = switch (std.Target.current.os.tag) {
 .linux => "Linux",  .linux => "Linux",
 else => "not Linux",  else => "not Linux",
}; };
const Book = enum { const Book = enum {
 paperback,  paperback,
 hardcover,  hardcover,
 ebook,  ebook,
 pdf,  pdf,
}; };
const TokenType = union(enum) { const TokenType = union(enum) {
@@ -54,54 +54,54 @@
}; };
const array_lit: [4]u8 = .{ 11, 22, 33, 44 }; const array_lit: [4]u8 = .{ 11, 22, 33, 44 };
const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 }; const sentinal_lit = [_:0]u8{ 1, 2, 3, 4 };
test "address of syntax" { test "address of syntax" {
 // Get the address of a variable:  // Get the address of a variable:
 const x: i32 = 1234;  const x: i32 = 1234;
 const x_ptr = &x;  const x_ptr = &x;
 // Dereference a pointer:  // Dereference a pointer:
 expect(x_ptr.* == 1234);  expect(x_ptr.* == 1234);
 // When you get the address of a const variable, you get a const pointer to a single item.  // When you get the address of a const variable, you get a const pointer to a single item.
 expect(@TypeOf(x_ptr) == *const i32);  expect(@TypeOf(x_ptr) == *const i32);
 // If you want to mutate the value, you'd need an address of a mutable variable:  // If you want to mutate the value, you'd need an address of a mutable variable:
 var y: i32 = 5678;  var y: i32 = 5678;
 const y_ptr = &y;  const y_ptr = &y;
 expect(@TypeOf(y_ptr) == *i32);  expect(@TypeOf(y_ptr) == *i32);
 y_ptr.* += 1;  y_ptr.* += 1;
 expect(y_ptr.* == 5679);  expect(y_ptr.* == 5679);
} }
// integer literals // integer literals
const decimal_int = 98222; const decimal_int = 98222;
const hex_int = 0xff; const hex_int = 0xff;
const another_hex_int = 0xFF; const another_hex_int = 0xFF;
const octal_int = 0o755; const octal_int = 0o755;
const binary_int = 0b11110000; const binary_int = 0b11110000;
// underscores may be placed between two digits as a visual separator // underscores may be placed between two digits as a visual separator
const one_billion = 1_000_000_000; const one_billion = 1_000_000_000;
const binary_mask = 0b1_1111_1111; const binary_mask = 0b1_1111_1111;
const permissions = 0o7_5_5; const permissions = 0o7_5_5;
const big_address = 0xFF80_0000_0000_0000; const big_address = 0xFF80_0000_0000_0000;
// float literals // float literals
const floating_point = 123.0E+77; const floating_point = 123.0E+77;
const another_float = 123.0; const another_float = 123.0;
const yet_another = 123.0e+77; const yet_another = 123.0e+77;
const hex_floating_point = 0x103.70p-5; const hex_floating_point = 0x103.70p-5;
const another_hex_float = 0x103.70; const another_hex_float = 0x103.70;
const yet_another_hex_float = 0x103.70P-5; const yet_another_hex_float = 0x103.70P-5;
// underscores may be placed between two digits as a visual separator // underscores may be placed between two digits as a visual separator
const lightspeed = 299_792_458.000_000; const lightspeed = 299_792_458.000_000;
const nanosecond = 0.000_000_001; const nanosecond = 0.000_000_001;
const more_hex = 0x1234_5678.9ABC_CDEFp-10; const more_hex = 0x1234_5678.9ABC_CDEFp-10;
fn max(comptime T: type, a: T, b: T) T { fn max(comptime T: type, a: T, b: T) T {
 return if (a > b) a else b;  return if (a > b) a else b;
} }

View File

@@ -1,54 +0,0 @@
bat 0.20.0 (e735562-modified)
A cat(1) clone with syntax highlighting and Git integration.
USAGE:
 bat [OPTIONS] [FILE]...
 bat <SUBCOMMAND>
OPTIONS:
 -A, --show-all
 Show non-printable characters (space, tab, newline, ..).
 -p, --plain Show plain style (alias for '--style=plain').
 -l, --language <language> Set the language for syntax highlighting.
 -H, --highlight-line <N:M>... Highlight lines N through M.
 --file-name <name>... Specify the name to display for a file.
 -d, --diff
 Only show lines that have been added/removed/modified.
 --tabs <T> Set the tab width to T spaces.
 --wrap <mode>
 Specify the text-wrapping mode (*auto*, never, character).
 -n, --number
 Show line numbers (alias for '--style=numbers').
 --color <when> When to use colors (*auto*, never, always).
 --italic-text <when> Use italics in output (always, *never*)
 --decorations <when>
 When to show the decorations (*auto*, never, always).
 --paging <when>
 Specify when to use the pager, or use `-P` to disable (*auto*, never,
 always).
 -m, --map-syntax <glob:syntax>...
 Use the specified syntax for files matching the glob pattern
 ('*.cpp:C++').
 --theme <theme> Set the color theme for syntax highlighting.
 --list-themes Display all supported highlighting themes.
 --style <components>
 Comma-separated list of style elements to display (*auto*, full, plain,
 changes, header, grid, rule, numbers, snip).
 -r, --line-range <N:M>... Only print the lines from N to M.
 -L, --list-languages Display all supported languages.
 -h, --help Print this help message.
 -V, --version Show version information.
ARGS:
 <FILE>... File(s) to print / concatenate. Use '-' for standard input.
SUBCOMMANDS:
 cache Modify the syntax-definition and theme cache
Note: `bat -h` prints a short and concise overview while `bat --help` gives all
details.

View File

@@ -1,5 +0,0 @@
[section]
key=value
# This file is just for testing that the INI syntax is registered to handle
# the .inf file extension, it is not testing the syntax highlighting capabilities
# of the INI syntax itself

View File

@@ -1,25 +0,0 @@
The `sample.jq` file was taken from [SublimeJQ] under the following license:
[SublimeJQ]: https://github.com/zogwarg/SublimeJQ
MIT License
Copyright (c) 2017 Thomas Buick
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -1,60 +0,0 @@
import "../imported-file" ;
# With Comments !
def weird($a; $b; $c):
[ $a, $b, $c ] | transpose | reduce .[][] as $item (
[];
. + $item.property
)
;
. | weird (.a; .b; .c) |
(
if (. | contains("never") ) then
"Why yes"
else
12.23
end
) as $never |
{
hello,
why: "because",
hello: ( weird | ascii_upcase ),
format_eg: ( . | @json "My json string \( . | this | part | just | white | ascii_upcase | transpose)" ),
never: $never,
"literal_key": literal_value,
"this": 12.1e12,
"part": "almost"
"like": [
12,
2
"json"
{
"quite": {
similar: "but not quite"
}
}
],
} | (
# And with very basic brace matching
# Invalid End
]
# Other invalid ends
( [ } ] )
# A "valid" sequence
( [ { key: () , other_key:( [ [] [[]] ] ), gaga } ] )
# A "invalid" sequence
( [ { key: () , other_key:( [ [] [[] ] ), gaga } ] )
"A string\n whith escaped characters \" because we can"
)

View File

@@ -1,3 +1,2 @@
2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html 2021-03-06 23:22:21.392 https://[2001:db8:4006:812::200e]:8080/path/the%20page.html
2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html 2021-03-06 23:22:21 https://example.com:8080/path/the%20page(with_parens).html
2022-03-16T17:41:02.519 helix_term::application [WARN] unhandled window/showMessage: ShowMessageParams { typ: Error, message: "rust-analyzer failed to load workspace: Failed to read Cargo metadata from Cargo.toml file /home/zeta/dev/raytracer/Cargo.toml, cargo 1.61.0-nightly (65c8266 2022-03-09): Failed to run `\"cargo\" \"metadata\" \"--format-version\" \"1\" \"--manifest-path\" \"/home/zeta/dev/raytracer/Cargo.toml\" \"--filter-platform\" \"wasm32-unknown-unknown\"`: `cargo metadata` exited with an error: Updating crates.io index\nerror: failed to select a version for `parking_lot`.\n ... required by package `raytracer v0.1.0 (/home/zeta/dev/raytracer)`\nversions that meet the requirements `^0.12.0` are: 0.12.0\n\nthe package `raytracer` depends on `parking_lot`, with features: `wasm-bindgen` but `parking_lot` does not have these features.\n\n\nfailed to select a version for `parking_lot` which could resolve this conflict\n" }

View File

@@ -27,13 +27,9 @@
</script> </script>
<script type="text/livescript"> <script type="text/livescript">
// This block is a regression test for a bat panic when a LiveScript syntax definition is missing // This block is a regression test for a bat panic when a LiveScript syntax definition is missing
</script> </script>
<style lang="text/postcss">
/* This block is a regression test for a bat panic when a PostCSS syntax definition is missing */
</style>
<style> <style>
main { main {
position: relative; position: relative;

View File

@@ -8,11 +8,6 @@
</div> </div>
</template> </template>
<template lang='pug'>
#container.col
p This shall be formatted as Plain Text as long as a Pug syntax definition is missing
</template>
<script> <script>
import AppHeader from "@/components/AppHeader"; import AppHeader from "@/components/AppHeader";
import AppLoadingIndicator from "@/components/AppLoadingIndicator"; import AppLoadingIndicator from "@/components/AppLoadingIndicator";

View File

@@ -1,54 +0,0 @@
bat 0.20.0 (e735562-modified)
A cat(1) clone with syntax highlighting and Git integration.
USAGE:
bat [OPTIONS] [FILE]...
bat <SUBCOMMAND>
OPTIONS:
-A, --show-all
Show non-printable characters (space, tab, newline, ..).
-p, --plain Show plain style (alias for '--style=plain').
-l, --language <language> Set the language for syntax highlighting.
-H, --highlight-line <N:M>... Highlight lines N through M.
--file-name <name>... Specify the name to display for a file.
-d, --diff
Only show lines that have been added/removed/modified.
--tabs <T> Set the tab width to T spaces.
--wrap <mode>
Specify the text-wrapping mode (*auto*, never, character).
-n, --number
Show line numbers (alias for '--style=numbers').
--color <when> When to use colors (*auto*, never, always).
--italic-text <when> Use italics in output (always, *never*)
--decorations <when>
When to show the decorations (*auto*, never, always).
--paging <when>
Specify when to use the pager, or use `-P` to disable (*auto*, never,
always).
-m, --map-syntax <glob:syntax>...
Use the specified syntax for files matching the glob pattern
('*.cpp:C++').
--theme <theme> Set the color theme for syntax highlighting.
--list-themes Display all supported highlighting themes.
--style <components>
Comma-separated list of style elements to display (*auto*, full, plain,
changes, header, grid, rule, numbers, snip).
-r, --line-range <N:M>... Only print the lines from N to M.
-L, --list-languages Display all supported languages.
-h, --help Print this help message.
-V, --version Show version information.
ARGS:
<FILE>... File(s) to print / concatenate. Use '-' for standard input.
SUBCOMMANDS:
cache Modify the syntax-definition and theme cache
Note: `bat -h` prints a short and concise overview while `bat --help` gives all
details.