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
61 changed files with 190 additions and 993 deletions

View File

@@ -7,26 +7,9 @@ assignees: ''
---
<!--
<!-- Hey there, thank you for creating an issue! -->
Hey there, thank you for reporting a bug!
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?**
**Describe the bug you encountered:**
...

View File

@@ -118,18 +118,6 @@ jobs:
toolchain: stable
default: true
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
env:
RUSTDOCFLAGS: -D warnings

8
.gitmodules vendored
View File

@@ -236,11 +236,3 @@
[submodule "assets/syntaxes/02_Extra/Dart"]
path = assets/syntaxes/02_Extra/Dart
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

@@ -1,56 +1,12 @@
# 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)
## Themes
## `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
# unreleased
## Features
- 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
- Fix bash completion on bash 3.x and bash-completion 1.x. See #2066 (@joshpencheon)
## Other
## Syntaxes
@@ -58,14 +14,12 @@
- Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002
- 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
- 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
- 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

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
[documentation](https://github.com/sharkdp/bat/blob/master/doc/assets.md)
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`.

133
Cargo.lock generated
View File

@@ -74,7 +74,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
[[package]]
name = "bat"
version = "0.21.0"
version = "0.19.0"
dependencies = [
"ansi_colours",
"ansi_term",
@@ -155,9 +155,9 @@ dependencies = [
[[package]]
name = "bugreport"
version = "0.5.0"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "535120b8182547808081a66f1f77a64533c780b23da26763e0ee34dfb94f98c9"
checksum = "0014b4b2b4f63bfe69c3838470121290cc437fdc79785d408a761a21e8b2404c"
dependencies = [
"git-version",
"shell-escape",
@@ -382,9 +382,9 @@ dependencies = [
[[package]]
name = "flate2"
version = "1.0.23"
version = "1.0.22"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b39522e96686d38f4bc984b9198e3a0613264abaebaff2c5c918bfa6b6da09af"
checksum = "1e6988e897c1c9c485f43b47a529cef42fde0547f9d8d41a7062518f1d8fc53f"
dependencies = [
"cfg-if",
"crc32fast",
@@ -452,9 +452,9 @@ dependencies = [
[[package]]
name = "git2"
version = "0.14.2"
version = "0.13.25"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3826a6e0e2215d7a41c2bfc7c9244123969273f3476b939a226aac0ab56e9e3c"
checksum = "f29229cc1b24c0e6062f6e742aa3e256492a5323365e5ed3413599f8a5eff7d6"
dependencies = [
"bitflags",
"libc",
@@ -581,16 +581,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.125"
name = "lazycell"
version = "1.3.0"
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]]
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"
checksum = "3a42de9a51a5c12e00fc0e4ca6bc2ea43582fc6418488e8f615e905d886f258b"
checksum = "19e1c899248e606fbfe68dcb31d8b0176ebab833b103824af31bddf4b7457494"
dependencies = [
"cc",
"libc",
@@ -656,23 +662,35 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "308cc39be01b73d0d18f82a0e7b2a3df85245f84af96fdddc5d202d27e47b86a"
[[package]]
name = "miniz_oxide"
version = "0.5.1"
name = "memoffset"
version = "0.6.5"
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 = [
"adler",
"autocfg",
]
[[package]]
name = "nix"
version = "0.24.1"
version = "0.23.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f17df307904acd05aa8e32e97bb20f2a0df1728bbc2d771ae8f9a90463441e9"
checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6"
dependencies = [
"bitflags",
"cc",
"cfg-if",
"libc",
"memoffset",
]
[[package]]
@@ -692,9 +710,9 @@ dependencies = [
[[package]]
name = "once_cell"
version = "1.10.0"
version = "1.9.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "87f3e037eac156d1775da914196f0f37741a274155e34a0b7e427c35d2a2ecb9"
checksum = "da32515d9f6e6e489d7bc9d84c71b060db7247dc035bbe44eac88cf87486d8d5"
[[package]]
name = "onig"
@@ -780,9 +798,9 @@ dependencies = [
[[package]]
name = "predicates"
version = "2.1.1"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a5aab5be6e4732b473071984b3164dbbfb7a3674d30ea5ff44410b6bcd960c3c"
checksum = "95e5a7689e456ab905c22c2b48225bb921aba7c8dfa58440d68ba13f6222a715"
dependencies = [
"difflib",
"float-cmp",
@@ -808,30 +826,6 @@ dependencies = [
"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]]
name = "proc-macro-hack"
version = "0.5.19"
@@ -877,9 +871,9 @@ dependencies = [
[[package]]
name = "regex"
version = "1.5.5"
version = "1.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a11647b6b25ff05a515cb92c365cec08801e83423a235b51e231e1808747286"
checksum = "d07a8629359eb56f1e2fb1652bb04212c072a87ba68546a04065d525673ac461"
dependencies = [
"aho-corasick",
"memchr",
@@ -916,12 +910,6 @@ dependencies = [
"bytemuck",
]
[[package]]
name = "rustversion"
version = "1.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f2cc38e8fa666e2de3c4aba7edeb5ffc5246c1c2ed0e3d17e560aeeba736b23f"
[[package]]
name = "ryu"
version = "1.0.9"
@@ -951,9 +939,9 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
[[package]]
name = "semver"
version = "1.0.7"
version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d65bd28f48be7196d222d95b9243287f48d27aca604e08497513019ff0502cc4"
checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
[[package]]
name = "serde"
@@ -1000,9 +988,9 @@ dependencies = [
[[package]]
name = "serial_test"
version = "0.6.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5bcc41d18f7a1d50525d080fd3e953be87c4f9f1a974f3c21798ca00d54ec15"
checksum = "e0bccbcf40c8938196944a3da0e133e031a33f4d6b72db3bda3cc556e361905d"
dependencies = [
"lazy_static",
"parking_lot",
@@ -1011,14 +999,12 @@ dependencies = [
[[package]]
name = "serial_test_derive"
version = "0.6.0"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2881bccd7d60fb32dfa3d7b3136385312f8ad75e2674aab2852867a09790cae8"
checksum = "b2acd6defeddb41eb60bb468f8825d0cfd0c2a76bc03bfd235b6a1dc4f6a1ad5"
dependencies = [
"proc-macro-error",
"proc-macro2",
"quote",
"rustversion",
"syn",
]
@@ -1030,9 +1016,9 @@ checksum = "45bb67a18fa91266cc7807181f62f9178a6873bfad7dc788c42e6430db40184f"
[[package]]
name = "shell-words"
version = "1.1.0"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde"
checksum = "b6fa3938c99da4914afedd13bf3d79bcb6c277d1b2c398d23257a304d9e1b074"
[[package]]
name = "smallvec"
@@ -1065,9 +1051,9 @@ dependencies = [
[[package]]
name = "syntect"
version = "5.0.0"
version = "4.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c6c454c27d9d7d9a84c7803aaa3c50cd088d2906fe3c6e42da3209aa623576a8"
checksum = "8b20815bbe80ee0be06e6957450a841185fcf690fe0178f14d77a05ce2caa031"
dependencies = [
"bincode",
"bitflags",
@@ -1075,14 +1061,13 @@ dependencies = [
"flate2",
"fnv",
"lazy_static",
"once_cell",
"lazycell",
"onig",
"plist",
"regex-syntax",
"serde",
"serde_derive",
"serde_json",
"thiserror",
"walkdir",
"yaml-rust",
]
@@ -1158,18 +1143,18 @@ dependencies = [
[[package]]
name = "thiserror"
version = "1.0.31"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bd829fe32373d27f76265620b5309d0340cb8550f523c1dda251d6298069069a"
checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.31"
version = "1.0.30"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0396bc89e626244658bef819e22d0cc459e795a5ebe878e6ec336d1674a8d79a"
checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
dependencies = [
"proc-macro2",
"quote",
@@ -1252,12 +1237,6 @@ version = "0.8.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
[[package]]
name = "version_check"
version = "0.9.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
[[package]]
name = "wait-timeout"
version = "0.2.0"

View File

@@ -6,7 +6,7 @@ homepage = "https://github.com/sharkdp/bat"
license = "MIT/Apache-2.0"
name = "bat"
repository = "https://github.com/sharkdp/bat"
version = "0.21.0"
version = "0.19.0"
exclude = ["assets/syntaxes/*", "assets/themes/*"]
build = "build.rs"
edition = '2018'
@@ -33,7 +33,8 @@ minimal-application = [
]
git = ["git2"] # Support indicating git modifications
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:
regex-onig = ["syntect/regex-onig"] # Use the "oniguruma" regex engine
@@ -46,12 +47,12 @@ ansi_colours = "^1.1"
bincode = "1.0"
console = "0.15.0"
flate2 = "1.0"
once_cell = "1.10"
once_cell = "1.9"
thiserror = "1.0"
wild = { version = "2.0", optional = true }
content_inspector = "0.2.4"
encoding = "0.2"
shell-words = { version = "1.1.0", optional = true }
shell-words = { version = "1.0.0", optional = true }
unicode-width = "0.1.9"
globset = "0.4"
serde = { version = "1.0", features = ["derive"] }
@@ -59,20 +60,20 @@ serde_yaml = "0.8"
semver = "1.0"
path_abs = { version = "0.5", default-features = false }
clircle = "0.3"
bugreport = { version = "0.5.0", optional = true }
bugreport = { version = "0.4", optional = true }
dirs-next = { version = "2.0.0", 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 }
bytesize = { version = "1.1.0" }
[dependencies.git2]
version = "0.14"
version = "0.13"
optional = true
default-features = false
[dependencies.syntect]
version = "5.0.0"
version = "4.6.0"
default-features = false
features = ["parsing"]
@@ -84,13 +85,13 @@ features = ["suggestions", "color", "wrap_help"]
[dev-dependencies]
assert_cmd = "2.0.4"
serial_test = "0.6.0"
predicates = "2.1.1"
serial_test = "0.5.1"
predicates = "2.1.0"
wait-timeout = "0.2.0"
tempfile = "3.3.0"
[target.'cfg(unix)'.dev-dependencies]
nix = { version = "0.24.1", default-features = false, features = ["term"] }
nix = "0.23.1"
[build-dependencies]
clap = { version = "2.34", optional = true }

View File

@@ -21,7 +21,7 @@
### 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">
<img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS">
<br>
@@ -171,7 +171,7 @@ You can combine `bat` with `git diff` to view lines around code changes with pro
highlighting:
```bash
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).
@@ -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`.
#### 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

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('--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('--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('--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, ..).')

View File

@@ -2,22 +2,9 @@
# 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() {
local cur prev words cword split=false
if declare -F _init_completion >/dev/null 2>&1; then
_init_completion -s || return 0
else
__bat_init_completion -n "=" || return 0
_split_longopt && split=true
fi
local cur prev words cword split
_init_completion -s || return 0
if [[ ${words[1]-} == cache ]]; then
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}} -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"

View File

@@ -75,7 +75,7 @@ _{{PROJECT_EXECUTABLE}}_main() {
;;
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
}

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').
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
values: *default*, full, auto, plain, changes, header, header-filename, header-filesize, grid,
rule, numbers, snip.
values: *full*, auto, plain, changes, header, grid, rule, numbers, snip.
.HP
\fB\-r\fR, \fB\-\-line\-range\fR <N:M>...
.IP

BIN
assets/syntaxes.bin vendored

Binary file not shown.

View File

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

View File

@@ -6,7 +6,6 @@ file_extensions:
scope: text.log
variables:
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:
main:
- match: (\w+)(=)
@@ -18,10 +17,11 @@ contexts:
captures:
1: punctuation.definition.string.begin.log
3: punctuation.definition.string.end.log
- match: \"
- match: (")([^"]*)(")
scope: string.quoted.double.log
captures:
1: punctuation.definition.string.begin.log
push: double_quoted_string
3: punctuation.definition.string.end.log
- include: dates
- include: ip_addresses
- include: numbers
@@ -29,34 +29,19 @@ contexts:
scope: markup.error.log
- match: \b(?i:warn(?:ing)?)\b
scope: markup.warning.log
- match: \b(?i:debug)\b
scope: markup.info.log
#- include: scope:text.html.markdown#autolink-inet
- match: \b\w+:/{2,3}
scope: markup.underline.link.scheme.log
push: url-host
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
push: maybe_date_time_separator
- 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
push: maybe_date_time_separator
- match: \b(?={{hours_minutes_seconds}})
push: time
time:
- match: (?:{{hours_minutes_seconds}})(?:(\.)\d{3})?\b
- match: \b(?:[01]\d|2[0-3]):(?:[0-5]\d):(?:[0-5]\d)(?:(\.)\d{3})?\b
scope: meta.time.log meta.number.integer.decimal.log constant.numeric.value.log
captures:
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:
- match: \b(?=(?:{{ipv4_part}}\.){3}{{ipv4_part}}\b)
push:
@@ -129,12 +114,3 @@ contexts:
scope: markup.underline.link.path.log
- match: ''
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` を使用)
*... や他の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`)
*... и другие дистрибутивы основанные на Debian.*

View File

@@ -1,5 +1,16 @@
# 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
- [ ] 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
`grep '^\s*MIN_SUPPORTED_RUST_VERSION' .github/workflows/CICD.yml`.
- [ ] Update the version and the min. supported Rust version in `README.md` and
`doc/README-*.md`. Check with
`git grep -i -e 'rust.*1\.' -e '1\..*rust' | grep README | grep -v tests/`.
`doc/README-*.md`. Check with `git grep -i 'rust.*1\.'` and
`git grep -i '1\..*rust'`.
- [ ] Update `CHANGELOG.md`. Introduce a section for the new release.
## 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
new version).
- [ ] Run `assets/create.sh` and check in the binary asset files.
## Documentation
- [ ] Review `-h`, `--help`, and the `man` page. All of these are shown in
the output of the CI job called *Documentation*, so look there.
The CI workflow corresponding to the tip of the master branch is a good place to look.
- [ ] Review the `-h` and `--help` texts
- [ ] Review the `man` page
## Pre-release checks
@@ -31,14 +41,13 @@
- [ ] Optional: manually test the new features and command-line options. To do
this, install the latest `bat` version again (to include the new syntaxes
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).
## Release
- [ ] 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.
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
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
@@ -51,23 +60,4 @@
## Post-release
- [ ] Prepare a new "unreleased" section at the top of `CHANGELOG.md`.
Put this at the top:
```
# unreleased
## Features
## Bugfixes
## Other
## Syntaxes
## Themes
## `bat` as a library
```
- [ ] Prepare a new (empty) "unreleased" section at the top of `CHANGELOG.md`.

View File

@@ -1,7 +1,5 @@
## 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`
project or affect the maintainers' actions in any way.
We remain impartial and continue to assess pull requests solely on merit - the

View File

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

View File

@@ -43,9 +43,8 @@ pub struct SyntaxReferenceInSet<'a> {
pub syntax_set: &'a SyntaxSet,
}
/// Lazy-loaded syntaxes are already compressed, and we don't want to compress
/// already compressed data.
pub(crate) const COMPRESS_SYNTAXES: bool = false;
/// Compress for size of ~700 kB instead of ~4600 kB at the cost of ~30% longer deserialization time
pub(crate) const COMPRESS_SYNTAXES: bool = true;
/// We don't want to compress our [LazyThemeSet] since the lazy-loaded themes
/// within it are already compressed, and compressing another time just makes
@@ -582,22 +581,13 @@ mod tests {
}
#[test]
fn syntax_detection_is_case_insensitive() {
fn syntax_detection_is_case_sensitive() {
let mut test = SyntaxDetectionTest::new();
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");
// Adding a mapping for "MD" in addition to "md" should not break the mapping
assert_ne!(test.syntax_for_file("README.MD"), "Markdown");
test.syntax_mapping
.insert("*.MD", MappingTarget::MapTo("Markdown"))
.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");
}

View File

@@ -322,7 +322,7 @@ impl App {
.collect::<Vec<_>>()
})
.or(env_style_components)
.unwrap_or_else(|| vec![StyleComponent::Default])
.unwrap_or_else(|| vec![StyleComponent::Full])
.into_iter()
.map(|style| style.components(self.interactive_output))
.fold(HashSet::new(), |mut acc, components| {

View File

@@ -398,7 +398,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
!&[
"auto",
"full",
"default",
"plain",
"header",
"header-filename",
@@ -420,7 +419,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
})
.help(
"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(
"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 \
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\").\n\n\
Possible values:\n\n \
* default: enables recommended style components (default).\n \
* full: enables all available components.\n \
* auto: same as 'default', unless the output is piped.\n \
* full: enables all available components (default).\n \
* auto: same as 'full', unless the output is piped.\n \
* plain: disables all available components.\n \
* changes: show Git modification markers.\n \
* header: alias for 'header-filename'.\n \

View File

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

View File

@@ -230,9 +230,6 @@ fn invoke_bugreport(app: &App) {
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".
let mut custom_assets_metadata = PROJECT_DIRS.cache_dir().to_path_buf();
custom_assets_metadata.push("metadata.yaml");
let mut report = bugreport!()
.info(SoftwareVersion::default())
.info(OperatingSystem::default())
@@ -257,14 +254,6 @@ fn invoke_bugreport(app: &App) {
"MANPAGER",
]))
.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());
#[cfg(feature = "paging")]

View File

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

View File

@@ -118,7 +118,7 @@ impl OpenedInput<'_> {
self.metadata
.user_provided_name
.as_ref()
.or(match self.kind {
.or_else(|| match self.kind {
OpenedInputKind::OrdinaryFile(ref path) => Some(path),
_ => None,
})

View File

@@ -3,38 +3,21 @@
use std::ffi::OsStr;
use std::process::Command;
#[derive(Debug, PartialEq)]
pub enum LessVersion {
Less(usize),
BusyBox,
}
pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<LessVersion> {
pub fn retrieve_less_version(less_path: &dyn AsRef<OsStr>) -> Option<usize> {
let resolved_path = grep_cli::resolve_binary(less_path.as_ref()).ok()?;
let cmd = Command::new(resolved_path).arg("--version").output().ok()?;
if cmd.status.success() {
parse_less_version(&cmd.stdout)
} else {
parse_less_version_busybox(&cmd.stderr)
}
parse_less_version(&cmd.stdout)
}
fn parse_less_version(output: &[u8]) -> Option<LessVersion> {
fn parse_less_version(output: &[u8]) -> Option<usize> {
if !output.starts_with(b"less ") {
return None;
}
let version = std::str::from_utf8(&output[5..]).ok()?;
let end = version.find(|c: char| !c.is_ascii_digit())?;
Some(LessVersion::Less(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,
}
version[..end].parse::<usize>().ok()
}
#[test]
@@ -47,7 +30,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution.
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]
@@ -60,7 +43,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution.
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]
@@ -73,7 +56,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution.
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]
@@ -86,7 +69,7 @@ For information about the terms of redistribution,
see the file named README in the less distribution.
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]
@@ -94,38 +77,4 @@ fn test_parse_less_version_wrong_program() {
let output = b"more from util-linux 2.34";
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::*;
#[cfg(feature = "paging")]
use crate::less::{retrieve_less_version, LessVersion};
use crate::less::retrieve_less_version;
#[cfg(feature = "paging")]
use crate::paging::PagingMode;
#[cfg(feature = "paging")]
@@ -83,13 +83,13 @@ impl OutputType {
let replace_arguments_to_less = pager.source == PagerSource::EnvVarPager;
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 {
p.arg("-F"); // Short version of --quit-if-one-screen for compatibility
p.arg("--quit-if-one-screen");
}
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
@@ -103,9 +103,7 @@ impl OutputType {
None => {
p.arg("--no-init");
}
Some(LessVersion::Less(version))
if (version < 530 || (cfg!(windows) && version < 558)) =>
{
Some(version) if (version < 530 || (cfg!(windows) && version < 558)) => {
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 mut idx = 0;
let mut line_idx = 0;
let len = input.len();
while idx < len {
if let Some((chr, skip_ahead)) = try_parse_utf8_char(&input[idx..]) {
idx += skip_ahead;
line_idx += 1;
match chr {
// space
' ' => output.push('·'),
// tab
'\t' => {
let tab_stop = tab_width - ((line_idx - 1) % tab_width);
line_idx = 0;
if tab_stop == 1 {
if tab_width == 1 {
output.push('↹');
} else {
output.push('├');
output.push_str(&"".repeat(tab_stop - 2));
output.push_str(&"".repeat(tab_width - 2));
output.push('┤');
}
}
// line feed
'\x0A' => {
output.push_str("\x0A");
line_idx = 0;
}
'\x0A' => output.push_str("\x0A"),
// carriage return
'\x0D' => output.push('␍'),
// null

View File

@@ -164,12 +164,6 @@ impl<'a> PrettyPrinter<'a> {
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)
pub fn snip(&mut self, yes: bool) -> &mut Self {
self.active_style_components.snip = yes;

View File

@@ -445,21 +445,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
return Ok(());
}
};
// 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_from_set
.highlighter
.highlight_line(for_highlighting, highlighter_from_set.syntax_set)?;
if too_long {
highlighted_line[0].1 = &line;
}
highlighted_line
.highlight(&line, highlighter_from_set.syntax_set)
};
if out_of_range {
@@ -475,10 +463,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
let highlight_this_line =
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
.background_color_highlight
.filter(|_| highlight_this_line);
@@ -665,11 +649,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
writeln!(handle)?;
}
if highlight_this_line && self.config.theme == "ansi" {
self.ansi_style.update("^[24m");
write!(handle, "\x1B[24m")?;
}
Ok(())
}
}

View File

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

View File

@@ -41,9 +41,6 @@ impl<'a> SyntaxMapping<'a> {
pub fn builtin() -> SyntaxMapping<'a> {
let mut mapping = Self::empty();
mapping.insert("*.h", MappingTarget::MapTo("C++")).unwrap();
mapping
.insert(".clang-format", MappingTarget::MapTo("YAML"))
.unwrap();
mapping.insert("*.fs", MappingTarget::MapTo("F#")).unwrap();
mapping
.insert("build", MappingTarget::MapToUnknown)
@@ -120,32 +117,13 @@ impl<'a> SyntaxMapping<'a> {
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
mapping
.insert("*.hook", MappingTarget::MapTo("INI"))
.unwrap();
// Global git config files rooted in `$XDG_CONFIG_HOME/git/` or `$HOME/.config/git/`
// See e.g. https://git-scm.com/docs/git-config#FILES
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");
if let Some(xdg_config_home) = std::env::var_os("XDG_CONFIG_HOME") {
let git_config_path = Path::new(&xdg_config_home).join("git");
mapping
.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 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 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>
<style lang="text/postcss">
 /* This block is a regression test for a bat panic when a PostCSS syntax definition is missing */
</style>
<style>
 main {
 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]: 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: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: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>
@@ -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 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: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 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:40:31 hostname-here scop hello
Aug 16 21:38:21 hostname-here systemd[1]: Finished Cleanup of Temporary Directories.

View File

@@ -8,11 +8,6 @@
 </div>
</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>
import AppHeader from "@/components/AppHeader";
import AppLoadingIndicator from "@/components/AppLoadingIndicator";

View File

@@ -1,18 +1,18 @@
//! this is a top level doc, starts with "//!"
const std = @import("std");
const std = @import("std");
pub fn main() anyerror!void {
 const stdout = std.io.getStdOut().writer();
 try stdout.print("Hello, {}!\n", .{"world"});
 const stdout = std.io.getStdOut().writer();
 try stdout.print("Hello, {}!\n", .{"world"});
}
const expect = std.testing.expect;
const expect = std.testing.expect;
test "comments" {
 // comments start with "//" until newline
 // foo bar baz
 const x = true; // another comment
 const x = true; // another comment
 expect(x);
}
@@ -25,26 +25,26 @@
 /// number of nanoseconds past the second
 nano: u32,
 const Self = @This();
 const Self = @This();
 pub fn unixEpoch() Self {
 return Self{
 .seconds = 0,
 .nanos = 0,
 .seconds = 0,
 .nanos = 0,
 };
 }
};
const my_val = switch (std.Target.current.os.tag) {
 .linux => "Linux",
const my_val = switch (std.Target.current.os.tag) {
 .linux => "Linux",
 else => "not Linux",
};
const Book = enum {
 paperback,
 hardcover,
 ebook,
 pdf,
 paperback,
 hardcover,
 ebook,
 pdf,
};
const TokenType = union(enum) {
@@ -54,54 +54,54 @@
};
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" {
 // Get the address of a variable:
 const x: i32 = 1234;
 const x_ptr = &x;
 const x_ptr = &x;
 // Dereference a pointer:
 expect(x_ptr.* == 1234);
 // 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:
 var y: i32 = 5678;
 const y_ptr = &y;
 expect(@TypeOf(y_ptr) == *i32);
 y_ptr.* += 1;
 const y_ptr = &y;
 expect(@TypeOf(y_ptr) == *i32);
 y_ptr.* += 1;
 expect(y_ptr.* == 5679);
}
// integer literals
const decimal_int = 98222;
const hex_int = 0xff;
const another_hex_int = 0xFF;
const octal_int = 0o755;
const binary_int = 0b11110000;
const decimal_int = 98222;
const hex_int = 0xff;
const another_hex_int = 0xFF;
const octal_int = 0o755;
const binary_int = 0b11110000;
// underscores may be placed between two digits as a visual separator
const one_billion = 1_000_000_000;
const binary_mask = 0b1_1111_1111;
const permissions = 0o7_5_5;
const big_address = 0xFF80_0000_0000_0000;
const one_billion = 1_000_000_000;
const binary_mask = 0b1_1111_1111;
const permissions = 0o7_5_5;
const big_address = 0xFF80_0000_0000_0000;
// float literals
const floating_point = 123.0E+77;
const another_float = 123.0;
const yet_another = 123.0e+77;
const floating_point = 123.0E+77;
const another_float = 123.0;
const yet_another = 123.0e+77;
const hex_floating_point = 0x103.70p-5;
const another_hex_float = 0x103.70;
const yet_another_hex_float = 0x103.70P-5;
const hex_floating_point = 0x103.70p-5;
const another_hex_float = 0x103.70;
const yet_another_hex_float = 0x103.70P-5;
// underscores may be placed between two digits as a visual separator
const lightspeed = 299_792_458.000_000;
const nanosecond = 0.000_000_001;
const more_hex = 0x1234_5678.9ABC_CDEFp-10;
const lightspeed = 299_792_458.000_000;
const nanosecond = 0.000_000_001;
const more_hex = 0x1234_5678.9ABC_CDEFp-10;
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 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 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>
<style lang="text/postcss">
/* This block is a regression test for a bat panic when a PostCSS syntax definition is missing */
</style>
<style>
main {
position: relative;

View File

@@ -8,11 +8,6 @@
</div>
</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>
import AppHeader from "@/components/AppHeader";
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.