mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-01 10:52:24 +01:00
Compare commits
4 Commits
bat-plugin
...
sponsor
Author | SHA1 | Date | |
---|---|---|---|
|
6a6041c72c | ||
|
0d93abde67 | ||
|
1cc39a790f | ||
|
2d93da1869 |
21
.github/ISSUE_TEMPLATE/bug_report.md
vendored
21
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -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:**
|
||||
|
||||
...
|
||||
|
||||
|
2
.github/ISSUE_TEMPLATE/question.md
vendored
2
.github/ISSUE_TEMPLATE/question.md
vendored
@@ -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. -->
|
||||
|
14
.github/workflows/CICD.yml
vendored
14
.github/workflows/CICD.yml
vendored
@@ -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
|
||||
@@ -154,7 +142,7 @@ jobs:
|
||||
- { target: x86_64-apple-darwin , os: macos-10.15 }
|
||||
- { target: x86_64-pc-windows-gnu , 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 }
|
||||
steps:
|
||||
- name: Checkout source code
|
||||
|
8
.gitmodules
vendored
8
.gitmodules
vendored
@@ -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
|
||||
|
69
CHANGELOG.md
69
CHANGELOG.md
@@ -2,72 +2,11 @@
|
||||
|
||||
## 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)
|
||||
- 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
|
||||
|
||||
@@ -75,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
|
||||
|
||||
|
@@ -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`.
|
||||
|
158
Cargo.lock
generated
158
Cargo.lock
generated
@@ -74,7 +74,7 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
||||
|
||||
[[package]]
|
||||
name = "bat"
|
||||
version = "0.21.0"
|
||||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"ansi_colours",
|
||||
"ansi_term",
|
||||
@@ -98,7 +98,6 @@ dependencies = [
|
||||
"path_abs",
|
||||
"predicates",
|
||||
"regex",
|
||||
"rlua",
|
||||
"semver",
|
||||
"serde",
|
||||
"serde_yaml",
|
||||
@@ -156,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",
|
||||
@@ -383,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",
|
||||
@@ -453,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",
|
||||
@@ -582,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",
|
||||
@@ -657,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]]
|
||||
@@ -693,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"
|
||||
@@ -781,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",
|
||||
@@ -809,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"
|
||||
@@ -878,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",
|
||||
@@ -917,36 +910,6 @@ dependencies = [
|
||||
"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]]
|
||||
name = "ryu"
|
||||
version = "1.0.9"
|
||||
@@ -976,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"
|
||||
@@ -1025,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",
|
||||
@@ -1036,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",
|
||||
]
|
||||
|
||||
@@ -1055,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"
|
||||
@@ -1090,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",
|
||||
@@ -1100,14 +1061,13 @@ dependencies = [
|
||||
"flate2",
|
||||
"fnv",
|
||||
"lazy_static",
|
||||
"once_cell",
|
||||
"lazycell",
|
||||
"onig",
|
||||
"plist",
|
||||
"regex-syntax",
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_json",
|
||||
"thiserror",
|
||||
"walkdir",
|
||||
"yaml-rust",
|
||||
]
|
||||
@@ -1183,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",
|
||||
@@ -1277,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"
|
||||
|
25
Cargo.toml
25
Cargo.toml
@@ -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'
|
||||
@@ -30,11 +30,11 @@ minimal-application = [
|
||||
"paging",
|
||||
"regex-onig",
|
||||
"wild",
|
||||
"rlua"
|
||||
]
|
||||
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
|
||||
@@ -47,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"] }
|
||||
@@ -60,21 +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" }
|
||||
rlua = { version = "0.19", optional = true }
|
||||
|
||||
[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"]
|
||||
|
||||
@@ -86,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 }
|
||||
|
22
README.md
22
README.md
@@ -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
|
||||
|
||||
|
BIN
assets/acknowledgements.bin
vendored
BIN
assets/acknowledgements.bin
vendored
Binary file not shown.
2
assets/completions/_bat.ps1.in
vendored
2
assets/completions/_bat.ps1.in
vendored
@@ -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, ..).')
|
||||
|
17
assets/completions/bat.bash.in
vendored
17
assets/completions/bat.bash.in
vendored
@@ -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
|
||||
|
2
assets/completions/bat.fish.in
vendored
2
assets/completions/bat.fish.in
vendored
@@ -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"
|
||||
|
||||
|
2
assets/completions/bat.zsh.in
vendored
2
assets/completions/bat.zsh.in
vendored
@@ -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
|
||||
}
|
||||
|
3
assets/manual/bat.1.in
vendored
3
assets/manual/bat.1.in
vendored
@@ -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
BIN
assets/syntaxes.bin
vendored
Binary file not shown.
2
assets/syntaxes/02_Extra/Fish
vendored
2
assets/syntaxes/02_Extra/Fish
vendored
Submodule assets/syntaxes/02_Extra/Fish updated: 98316d4332...2c254cc851
4
assets/syntaxes/02_Extra/INI.sublime-syntax
vendored
4
assets/syntaxes/02_Extra/INI.sublime-syntax
vendored
@@ -5,8 +5,8 @@ name: INI
|
||||
file_extensions:
|
||||
- ini
|
||||
- INI
|
||||
- "inf"
|
||||
- "INF"
|
||||
- inf
|
||||
- INF
|
||||
- reg
|
||||
- REG
|
||||
- lng
|
||||
|
2
assets/syntaxes/02_Extra/Nginx
vendored
2
assets/syntaxes/02_Extra/Nginx
vendored
Submodule assets/syntaxes/02_Extra/Nginx updated: 65f5a63c0d...15a1db1510
1
assets/syntaxes/02_Extra/SublimeJQ
vendored
1
assets/syntaxes/02_Extra/SublimeJQ
vendored
Submodule assets/syntaxes/02_Extra/SublimeJQ deleted from 687058289c
2
assets/syntaxes/02_Extra/Zig
vendored
2
assets/syntaxes/02_Extra/Zig
vendored
Submodule assets/syntaxes/02_Extra/Zig updated: 1a4a38445f...87ecbcae6f
1
assets/syntaxes/02_Extra/cmd-help
vendored
1
assets/syntaxes/02_Extra/cmd-help
vendored
Submodule assets/syntaxes/02_Extra/cmd-help deleted from 1e513f5f19
36
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
36
assets/syntaxes/02_Extra/log.sublime-syntax
vendored
@@ -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
BIN
assets/themes.bin
vendored
Binary file not shown.
@@ -181,7 +181,7 @@ man 2 select
|
||||
|
||||
## インストール
|
||||
|
||||
[](https://repology.org/project/bat-cat/versions)
|
||||
[](https://repology.org/project/bat/versions)
|
||||
|
||||
### On Ubuntu (`apt` を使用)
|
||||
*... や他のDebianベースのLinuxディストリビューション*
|
||||
|
@@ -160,7 +160,7 @@ man 2 select
|
||||
|
||||
## Установка
|
||||
|
||||
[](https://repology.org/project/bat-cat/versions)
|
||||
[](https://repology.org/project/bat/versions)
|
||||
|
||||
### Ubuntu (с помощью `apt`)
|
||||
*... и другие дистрибутивы основанные на Debian.*
|
||||
|
@@ -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`.
|
||||
|
@@ -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
|
||||
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -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
|
@@ -1 +0,0 @@
|
||||
# Defaults are used
|
@@ -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
|
||||
@@ -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 {
|
||||
#[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"
|
||||
}
|
||||
|
||||
/**
|
||||
* 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> {
|
||||
Ok(HighlightingAssets::new(
|
||||
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())
|
||||
}
|
||||
|
||||
#[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)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -639,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");
|
||||
}
|
||||
|
||||
|
@@ -241,11 +241,6 @@ impl App {
|
||||
.map(HighlightedLineRanges)
|
||||
.unwrap_or_default(),
|
||||
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<_>>()
|
||||
})
|
||||
.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| {
|
||||
|
@@ -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 \
|
||||
@@ -474,16 +472,6 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||
.help("Display all supported languages.")
|
||||
.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::with_name("unbuffered")
|
||||
.short("u")
|
||||
|
@@ -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>> {
|
||||
|
@@ -8,7 +8,6 @@ mod directories;
|
||||
mod input;
|
||||
|
||||
use std::collections::{HashMap, HashSet};
|
||||
use std::ffi::OsStr;
|
||||
use std::io;
|
||||
use std::io::{BufReader, Write};
|
||||
use std::path::Path;
|
||||
@@ -219,66 +218,7 @@ pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn load_and_run_preprocess_plugins(plugins: &[&OsStr], inputs: &mut Vec<Input>) -> Result<()> {
|
||||
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)?;
|
||||
|
||||
fn run_controller(inputs: Vec<Input>, config: &Config) -> Result<bool> {
|
||||
let assets = assets_from_cache_or_binary(config.use_custom_assets)?;
|
||||
let controller = Controller::new(config, &assets);
|
||||
controller.run(inputs)
|
||||
@@ -290,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())
|
||||
@@ -317,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")]
|
||||
|
@@ -5,8 +5,6 @@ use crate::style::StyleComponents;
|
||||
use crate::syntax_mapping::SyntaxMapping;
|
||||
use crate::wrapping::WrappingMode;
|
||||
|
||||
use std::ffi::OsStr;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum VisibleLines {
|
||||
/// 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.
|
||||
/// cached assets) are not available, assets from the binary will be used instead.
|
||||
pub use_custom_assets: bool,
|
||||
|
||||
/// List of bat plugins to be loaded
|
||||
pub plugins: Vec<&'a OsStr>,
|
||||
}
|
||||
|
||||
#[cfg(all(feature = "minimal-application", feature = "paging"))]
|
||||
|
@@ -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)]
|
||||
|
14
src/input.rs
14
src/input.rs
@@ -69,8 +69,7 @@ impl InputDescription {
|
||||
}
|
||||
}
|
||||
|
||||
pub enum InputKind<'a> {
|
||||
// TODO
|
||||
pub(crate) enum InputKind<'a> {
|
||||
OrdinaryFile(PathBuf),
|
||||
StdIn,
|
||||
CustomReader(Box<dyn Read + 'a>),
|
||||
@@ -87,15 +86,14 @@ impl<'a> InputKind<'a> {
|
||||
}
|
||||
|
||||
#[derive(Clone, Default)]
|
||||
pub struct InputMetadata {
|
||||
// TODO
|
||||
pub user_provided_name: Option<PathBuf>,
|
||||
pub(crate) struct InputMetadata {
|
||||
pub(crate) user_provided_name: Option<PathBuf>,
|
||||
pub(crate) size: Option<u64>,
|
||||
}
|
||||
|
||||
pub struct Input<'a> {
|
||||
pub kind: InputKind<'a>, // TODO
|
||||
pub metadata: InputMetadata, // TODO
|
||||
pub(crate) kind: InputKind<'a>,
|
||||
pub(crate) metadata: InputMetadata,
|
||||
pub(crate) description: InputDescription,
|
||||
}
|
||||
|
||||
@@ -120,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,
|
||||
})
|
||||
|
67
src/less.rs
67
src/less.rs
@@ -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));
|
||||
}
|
||||
|
@@ -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");
|
||||
}
|
||||
_ => {}
|
||||
|
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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(())
|
||||
}
|
||||
}
|
||||
|
12
src/style.rs
12
src/style.rs
@@ -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()),
|
||||
}
|
||||
|
@@ -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(
|
||||
|
3
tests/examples/git/.config/git/config
vendored
3
tests/examples/git/.config/git/config
vendored
@@ -1,3 +0,0 @@
|
||||
[user]
|
||||
email = foo@bar.net
|
||||
name = foobar
|
3
tests/examples/git/.gitconfig
vendored
3
tests/examples/git/.gitconfig
vendored
@@ -1,3 +0,0 @@
|
||||
[user]
|
||||
email = foo@bar.net
|
||||
name = foobar
|
3
tests/examples/longline.json
vendored
3
tests/examples/longline.json
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
5
tests/syntax-tests/highlighted/INI/test.inf
vendored
5
tests/syntax-tests/highlighted/INI/test.inf
vendored
@@ -1,5 +0,0 @@
|
||||
[38;2;248;248;242m[[0m[38;2;166;226;46msection[0m[38;2;248;248;242m][0m
|
||||
[38;2;249;38;114mkey[0m[38;2;248;248;242m=[0m[38;2;230;219;116mvalue[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m This file is just for testing that the INI syntax is registered to handle[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m the .inf file extension, it is not testing the syntax highlighting capabilities[0m
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m of the INI syntax itself[0m
|
60
tests/syntax-tests/highlighted/JQ/sample.jq
vendored
60
tests/syntax-tests/highlighted/JQ/sample.jq
vendored
@@ -1,60 +0,0 @@
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m../imported-file[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;117;113;94m#[0m[38;2;117;113;94m With Comments ![0m
|
||||
[38;2;249;38;114mdef[0m[38;2;248;248;242m [0m[38;2;166;226;46mweird[0m[38;2;248;248;242m([0m[3;38;2;253;151;31m$a[0m[38;2;248;248;242m; [0m[3;38;2;253;151;31m$b[0m[38;2;248;248;242m; [0m[3;38;2;253;151;31m$c[0m[38;2;248;248;242m)[0m[38;2;248;248;242m:[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m[ [0m[38;2;255;255;255m$a[0m[38;2;248;248;242m, [0m[38;2;255;255;255m$b[0m[38;2;248;248;242m, [0m[38;2;255;255;255m$c[0m[38;2;248;248;242m ][0m[38;2;248;248;242m | [0m[38;2;102;217;239mtranspose[0m[38;2;248;248;242m | [0m[38;2;249;38;114mreduce[0m[38;2;248;248;242m .[0m[38;2;248;248;242m[][0m[38;2;248;248;242m[][0m[38;2;248;248;242m [0m[38;2;249;38;114mas[0m[38;2;248;248;242m [0m[38;2;255;255;255m$item[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m[][0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m . + [0m[38;2;255;255;255m$item[0m[38;2;248;248;242m.property[0m
|
||||
[38;2;248;248;242m )[0m
|
||||
[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m. | weird [0m[38;2;248;248;242m(.a; .b; .c)[0m[38;2;248;248;242m |[0m
|
||||
|
||||
[38;2;248;248;242m([0m
|
||||
|
||||
[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m(. | [0m[38;2;102;217;239mcontains[0m[38;2;248;248;242m([0m[38;2;230;219;116m"[0m[38;2;230;219;116mnever[0m[38;2;230;219;116m"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m )[0m[38;2;248;248;242m [0m[38;2;249;38;114mthen[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mWhy yes[0m[38;2;230;219;116m"[0m
|
||||
[38;2;249;38;114melse[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m12.23[0m
|
||||
[38;2;249;38;114mend[0m
|
||||
|
||||
[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114mas[0m[38;2;248;248;242m [0m[38;2;255;255;255m$never[0m[38;2;248;248;242m |[0m
|
||||
|
||||
[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mhello[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mwhy[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbecause[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mhello[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m( weird | [0m[38;2;102;217;239mascii_upcase[0m[38;2;248;248;242m )[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mformat_eg[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m( . | [0m[38;2;190;132;255m@json[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mMy json string [0m[38;2;190;132;255m\([0m[38;2;248;248;242m . | this | part | just | white | ascii_upcase | transpose[0m[38;2;190;132;255m)[0m[38;2;230;219;116m"[0m[38;2;248;248;242m )[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46mnever[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;255;255;255m$never[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mliteral_key[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m literal_value[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mthis[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m12.1e12[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mpart[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116malmost[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mlike[0m[38;2;230;219;116m"[0m[38;2;248;248;242m: [0m[38;2;248;248;242m[[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m12[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m2[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mjson[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mquite[0m[38;2;230;219;116m"[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46msimilar[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mbut not quite[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m ][0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m}[0m[38;2;248;248;242m | [0m[38;2;248;248;242m([0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m And with very basic brace matching[0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Invalid End[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;240m][0m[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m Other invalid ends[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m( [0m[38;2;248;248;242m[ [0m[38;2;248;248;240m}[0m[38;2;248;248;242m [0m[38;2;248;248;240m][0m[38;2;248;248;242m )[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m A "valid" sequence[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m( [0m[38;2;248;248;242m[ [0m[38;2;248;248;242m{ [0m[38;2;166;226;46mkey[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m()[0m[38;2;248;248;242m [0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;166;226;46mother_key[0m[38;2;248;248;242m:[0m[38;2;248;248;242m( [0m[38;2;248;248;242m[ [0m[38;2;248;248;242m[][0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242m[][0m[38;2;248;248;242m][0m[38;2;248;248;242m ][0m[38;2;248;248;242m )[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;166;226;46mgaga[0m[38;2;248;248;242m }[0m[38;2;248;248;242m ][0m[38;2;248;248;242m )[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m#[0m[38;2;117;113;94m A "invalid" sequence[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m( [0m[38;2;248;248;242m[ [0m[38;2;248;248;242m{ [0m[38;2;166;226;46mkey[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m()[0m[38;2;248;248;242m [0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;166;226;46mother_key[0m[38;2;248;248;242m:[0m[38;2;248;248;242m( [0m[38;2;248;248;242m[ [0m[38;2;248;248;242m[][0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[38;2;248;248;242m[][0m[38;2;248;248;242m ][0m[38;2;248;248;242m [0m[38;2;248;248;240m)[0m[38;2;248;248;242m, gaga [0m[38;2;248;248;240m}[0m[38;2;248;248;242m ] )[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116mA string[0m[38;2;190;132;255m\[0m[38;2;190;132;255mn[0m[38;2;230;219;116m whith escaped characters [0m[38;2;190;132;255m\[0m[38;2;190;132;255m"[0m[38;2;230;219;116m because we can[0m[38;2;230;219;116m"[0m
|
||||
[38;2;248;248;242m)[0m
|
||||
|
@@ -1,3 +1,2 @@
|
||||
[38;2;190;132;255m2021-03-06[0m[38;2;248;248;242m [0m[38;2;190;132;255m23:22:21[0m[38;2;190;132;255m.[0m[38;2;190;132;255m392[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mhttps://[0m[4;38;2;166;226;46m[[0m[4;38;2;190;132;255m2001[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255mdb8[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m4006[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m812[0m[4;38;2;166;226;46m:[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m200e[0m[4;38;2;166;226;46m][0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m8080[0m[4;38;2;166;226;46m/path/the[0m[4;38;2;190;132;255m%[0m[4;38;2;190;132;255m20[0m[4;38;2;166;226;46mpage[0m[4;38;2;166;226;46m.[0m[4;38;2;166;226;46mhtml[0m
|
||||
[38;2;190;132;255m2021-03-06[0m[38;2;248;248;242m [0m[38;2;190;132;255m23:22:21[0m[38;2;248;248;242m [0m[4;38;2;166;226;46mhttps://[0m[4;38;2;166;226;46mexample.com[0m[4;38;2;166;226;46m:[0m[4;38;2;190;132;255m8080[0m[4;38;2;166;226;46m/path/the[0m[4;38;2;190;132;255m%[0m[4;38;2;190;132;255m20[0m[4;38;2;166;226;46mpage[0m[4;38;2;166;226;46m(with_parens)[0m[4;38;2;166;226;46m.[0m[4;38;2;166;226;46mhtml[0m
|
||||
[38;2;190;132;255m2022-03-16[0m[38;2;249;38;114mT[0m[38;2;190;132;255m17:41:02[0m[38;2;190;132;255m.[0m[38;2;190;132;255m519[0m[38;2;248;248;242m helix_term::application [[0m[38;2;248;248;240mWARN[0m[38;2;248;248;242m] unhandled window/showMessage: ShowMessageParams { typ: [0m[38;2;248;248;240mError[0m[38;2;248;248;242m, message: [0m[38;2;230;219;116m"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 `[0m[38;2;190;132;255m\"[0m[38;2;230;219;116mcargo[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116mmetadata[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m--format-version[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m1[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m--manifest-path[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m/home/zeta/dev/raytracer/Cargo.toml[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116m--filter-platform[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m [0m[38;2;190;132;255m\"[0m[38;2;230;219;116mwasm32-unknown-unknown[0m[38;2;190;132;255m\"[0m[38;2;230;219;116m`: `cargo metadata` exited with an error: Updating crates.io index[0m[38;2;190;132;255m\n[0m[38;2;230;219;116merror: failed to select a version for `parking_lot`.[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m ... required by package `raytracer v0.1.0 (/home/zeta/dev/raytracer)`[0m[38;2;190;132;255m\n[0m[38;2;230;219;116mversions that meet the requirements `^0.12.0` are: 0.12.0[0m[38;2;190;132;255m\n[0m[38;2;190;132;255m\n[0m[38;2;230;219;116mthe package `raytracer` depends on `parking_lot`, with features: `wasm-bindgen` but `parking_lot` does not have these features.[0m[38;2;190;132;255m\n[0m[38;2;190;132;255m\n[0m[38;2;190;132;255m\n[0m[38;2;230;219;116mfailed to select a version for `parking_lot` which could resolve this conflict[0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m[38;2;248;248;242m }[0m
|
||||
|
@@ -27,13 +27,9 @@
|
||||
[38;2;255;255;255m</[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
||||
|
||||
[38;2;255;255;255m<[0m[3;38;2;249;38;114mscript[0m[38;2;248;248;242m [0m[38;2;166;226;46mtype[0m[38;2;166;226;46m=[0m[38;2;255;255;255m"[0m[38;2;230;219;116mtext/livescript[0m[38;2;255;255;255m"[0m[38;2;255;255;255m>[0m
|
||||
[38;2;248;248;242m [0m[38;2;246;170;17m// This block is a regression test for a bat panic when a LiveScript syntax definition is missing[0m
|
||||
[38;2;248;248;242m [0m[38;2;246;170;17m// This block is a regression test for a bat panic when a LiveScript syntax definition is missing[0m
|
||||
[38;2;255;255;255m</[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
||||
|
||||
[38;2;255;255;255m<[0m[38;2;249;38;114mstyle[0m[38;2;248;248;242m [0m[38;2;166;226;46mlang[0m[38;2;166;226;46m=[0m[38;2;255;255;255m"[0m[38;2;230;219;116mtext/postcss[0m[38;2;255;255;255m"[0m[38;2;255;255;255m>[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/*[0m[38;2;117;113;94m This block is a regression test for a bat panic when a PostCSS syntax definition is missing [0m[38;2;117;113;94m*/[0m
|
||||
[38;2;255;255;255m</[0m[38;2;249;38;114mstyle[0m[38;2;255;255;255m>[0m
|
||||
|
||||
[38;2;255;255;255m<[0m[38;2;249;38;114mstyle[0m[38;2;255;255;255m>[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mmain[0m[38;2;248;248;242m [0m[38;2;255;255;255m{[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;102;217;239mposition[0m[38;2;255;255;255m:[0m[38;2;248;248;242m [0m[38;2;102;217;239mrelative[0m[38;2;255;255;255m;[0m
|
||||
|
@@ -1,7 +1,7 @@
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m logrotate.service: Succeeded.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Finished Rotate log files.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:01[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mcolord[0m[38;2;248;248;242m[[0m[38;2;190;132;255m920[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;240mfailed[0m[38;2;248;248;242m to get session [pid [0m[38;2;190;132;255m137485[0m[38;2;248;248;242m]: No data available[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mkernel[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31m55604[0m[38;2;248;248;242m.[0m[3;38;2;253;151;31m908232[0m[38;2;248;248;242m][0m[38;2;248;248;242m audit: [0m[3;38;2;253;151;31mtype[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1400[0m[38;2;248;248;242m audit([0m[38;2;190;132;255m1617483621[0m[38;2;190;132;255m.[0m[38;2;190;132;255m094[0m[38;2;248;248;242m:[0m[38;2;190;132;255m28[0m[38;2;248;248;242m): [0m[3;38;2;253;151;31mapparmor[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"DENIED[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperation[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"capable[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mprofile[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"/usr/sbin/cups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m59311[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcomm[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"cups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapability[0m[38;2;249;38;114m=[0m[38;2;190;132;255m23[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapname[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"sys_nice[0m[38;2;230;219;116m"[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:00:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mkernel[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31m55604[0m[38;2;248;248;242m.[0m[3;38;2;253;151;31m908232[0m[38;2;248;248;242m][0m[38;2;248;248;242m audit: [0m[3;38;2;253;151;31mtype[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1400[0m[38;2;248;248;242m audit([0m[38;2;190;132;255m1617483621[0m[38;2;190;132;255m.[0m[38;2;190;132;255m094[0m[38;2;248;248;242m:[0m[38;2;190;132;255m28[0m[38;2;248;248;242m): [0m[3;38;2;253;151;31mapparmor[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mDENIED[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31moperation[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcapable[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mprofile[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116m/usr/sbin/cups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m59311[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcomm[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116mcups-browsed[0m[38;2;230;219;116m"[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapability[0m[38;2;249;38;114m=[0m[38;2;190;132;255m23[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mcapname[0m[38;2;249;38;114m=[0m[38;2;230;219;116m"[0m[38;2;230;219;116msys_nice[0m[38;2;230;219;116m"[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:01:38[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd-resolved[0m[38;2;248;248;242m[[0m[38;2;190;132;255m721[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Server returned [0m[38;2;248;248;240merror[0m[38;2;248;248;242m NXDOMAIN, mitigating potential DNS violation DVE-[0m[38;2;190;132;255m2018[0m[38;2;248;248;242m-[0m[38;2;190;132;255m0001[0m[38;2;248;248;242m, retrying transaction with reduced feature level UDP.[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:04:46[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Soliciting pool server [0m[38;2;190;132;255m255[0m[38;2;248;248;242m.[0m[38;2;190;132;255m76[0m[38;2;248;248;242m.[0m[38;2;190;132;255m59[0m[38;2;248;248;242m.[0m[38;2;190;132;255m37[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m00:05:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mntpd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m952[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m:[0m[38;2;248;248;242m:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m local addr [0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m -> [0m[38;2;190;132;255m<null>[0m
|
||||
@@ -10,7 +10,7 @@
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m16:32:07[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mNetworkManager[0m[38;2;248;248;242m[[0m[38;2;190;132;255m740[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m<info>[0m[38;2;248;248;242m [[0m[38;2;190;132;255m1617629527[0m[38;2;190;132;255m.[0m[38;2;190;132;255m1101[0m[38;2;248;248;242m] manager: NetworkManager state is now CONNECTED_GLOBAL[0m
|
||||
[38;2;190;132;255mApr 4[0m[38;2;190;132;255m [0m[38;2;190;132;255m22:00:45[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mdbus-daemon[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1094[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;248;248;242m[[0m[3;38;2;253;151;31msession[0m[38;2;248;248;242m [0m[3;38;2;253;151;31muid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1000[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mpid[0m[38;2;249;38;114m=[0m[38;2;190;132;255m1094[0m[38;2;248;248;242m][0m[38;2;248;248;242m Successfully activated service [0m[38;2;230;219;116m'[0m[38;2;230;219;116mio.github.celluloid_player.Celluloid[0m[38;2;230;219;116m'[0m
|
||||
[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m13:29:06[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239minsomnia_insomnia.desktop[0m[38;2;248;248;242m[[0m[38;2;190;132;255m142666[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m13:29:06[0m[38;2;190;132;255m.[0m[38;2;190;132;255m316[0m[38;2;248;248;242m › [updater] Updater not running [0m[3;38;2;253;151;31mplatform[0m[38;2;249;38;114m=[0m[38;2;248;248;242mlinux [0m[3;38;2;253;151;31mdev[0m[38;2;249;38;114m=[0m[38;2;248;248;242mfalse[0m
|
||||
[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m13:36:34[0m[38;2;248;248;242m [0m[38;2;166;226;46m192.168.220.5[0m[38;2;248;248;242m [0m[38;2;102;217;239mnginx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2021/08/11[0m[38;2;248;248;242m [0m[38;2;190;132;255m13:36:34[0m[38;2;248;248;242m [[0m[38;2;248;248;242mdebug[0m[38;2;248;248;242m] [0m[38;2;190;132;255m2031[0m[38;2;248;248;242m#[0m[38;2;190;132;255m2031[0m[38;2;248;248;242m: epoll add event: fd:[0m[38;2;190;132;255m6[0m[38;2;248;248;242m op:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m ev:[0m[38;2;190;132;255m00002001[0m
|
||||
[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:31:08[0m[38;2;248;248;242m [0m[38;2;166;226;46m::1[0m[38;2;248;248;242m [0m[38;2;102;217;239mnginx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2021/08/11[0m[38;2;248;248;242m [0m[38;2;190;132;255m21:31:08[0m[38;2;248;248;242m [[0m[38;2;248;248;242mdebug[0m[38;2;248;248;242m] [0m[38;2;190;132;255m760831[0m[38;2;248;248;242m#[0m[38;2;190;132;255m760831[0m[38;2;248;248;242m: epoll add event: fd:[0m[38;2;190;132;255m6[0m[38;2;248;248;242m op:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m ev:[0m[38;2;190;132;255m10000001[0m
|
||||
[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m13:36:34[0m[38;2;248;248;242m [0m[38;2;166;226;46m192.168.220.5[0m[38;2;248;248;242m [0m[38;2;102;217;239mnginx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2021/08/11[0m[38;2;248;248;242m [0m[38;2;190;132;255m13:36:34[0m[38;2;248;248;242m [debug] [0m[38;2;190;132;255m2031[0m[38;2;248;248;242m#[0m[38;2;190;132;255m2031[0m[38;2;248;248;242m: epoll add event: fd:[0m[38;2;190;132;255m6[0m[38;2;248;248;242m op:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m ev:[0m[38;2;190;132;255m00002001[0m
|
||||
[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:31:08[0m[38;2;248;248;242m [0m[38;2;166;226;46m::1[0m[38;2;248;248;242m [0m[38;2;102;217;239mnginx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[38;2;190;132;255m2021/08/11[0m[38;2;248;248;242m [0m[38;2;190;132;255m21:31:08[0m[38;2;248;248;242m [debug] [0m[38;2;190;132;255m760831[0m[38;2;248;248;242m#[0m[38;2;190;132;255m760831[0m[38;2;248;248;242m: epoll add event: fd:[0m[38;2;190;132;255m6[0m[38;2;248;248;242m op:[0m[38;2;190;132;255m1[0m[38;2;248;248;242m ev:[0m[38;2;190;132;255m10000001[0m
|
||||
[38;2;190;132;255mAug 11[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:40:31[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239mscop[0m[38;2;248;248;242m [0m[38;2;248;248;242mhello[0m
|
||||
[38;2;190;132;255mAug 16[0m[38;2;190;132;255m [0m[38;2;190;132;255m21:38:21[0m[38;2;248;248;242m [0m[38;2;166;226;46mhostname-here[0m[38;2;248;248;242m [0m[38;2;102;217;239msystemd[0m[38;2;248;248;242m[[0m[38;2;190;132;255m1[0m[38;2;248;248;242m][0m[38;2;248;248;242m:[0m[38;2;248;248;242m Finished Cleanup of Temporary Directories.[0m
|
||||
|
@@ -8,11 +8,6 @@
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255m</[0m[38;2;249;38;114mdiv[0m[38;2;255;255;255m>[0m
|
||||
[38;2;255;255;255m</[0m[38;2;249;38;114mtemplate[0m[38;2;255;255;255m>[0m
|
||||
|
||||
[38;2;255;255;255m<[0m[38;2;249;38;114mtemplate [0m[38;2;166;226;46mlang[0m[38;2;166;226;46m=[0m[38;2;255;255;255m'[0m[38;2;230;219;116mpug[0m[38;2;255;255;255m'[0m[38;2;255;255;255m>[0m
|
||||
[38;2;248;248;242m #container.col[0m
|
||||
[38;2;248;248;242m p This shall be formatted as Plain Text as long as a Pug syntax definition is missing[0m
|
||||
[38;2;255;255;255m</[0m[38;2;249;38;114mtemplate[0m[38;2;255;255;255m>[0m
|
||||
|
||||
[38;2;255;255;255m<[0m[3;38;2;249;38;114mscript[0m[38;2;255;255;255m>[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;255;255;255mAppHeader[0m[38;2;248;248;242m [0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m@/components/AppHeader[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mimport[0m[38;2;248;248;242m [0m[38;2;255;255;255mAppLoadingIndicator[0m[38;2;248;248;242m [0m[38;2;249;38;114mfrom[0m[38;2;248;248;242m [0m[38;2;230;219;116m"[0m[38;2;230;219;116m@/components/AppLoadingIndicator[0m[38;2;230;219;116m"[0m[38;2;248;248;242m;[0m
|
||||
|
78
tests/syntax-tests/highlighted/Zig/example.zig
vendored
78
tests/syntax-tests/highlighted/Zig/example.zig
vendored
@@ -1,18 +1,18 @@
|
||||
[38;2;117;113;94m//! this is a top level doc, starts with "//!"[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m@import[0m[38;2;248;248;242m([0m[38;2;230;219;116m"std"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m std [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m@import[0m[38;2;248;248;242m([0m[38;2;230;219;116m"std"[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mpub[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mmain[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239manyerror[0m[38;2;249;38;114m![0m[3;38;2;102;217;239mvoid[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mstdout[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m.[0m[38;2;248;248;242mio[0m[38;2;248;248;242m.[0m[38;2;248;248;242mgetStdOut[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mwriter[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtry[0m[38;2;248;248;242m [0m[38;2;248;248;242mstdout[0m[38;2;248;248;242m.[0m[38;2;248;248;242mprint[0m[38;2;248;248;242m([0m[38;2;230;219;116m"Hello, {}![0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m .[0m[38;2;248;248;242m{[0m[38;2;230;219;116m"world"[0m[38;2;248;248;242m}[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m stdout [0m[38;2;249;38;114m=[0m[38;2;248;248;242m std.io.[0m[38;2;248;248;242mgetStdOut[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m.[0m[38;2;248;248;242mwriter[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mtry[0m[38;2;248;248;242m stdout.[0m[38;2;248;248;242mprint[0m[38;2;248;248;242m([0m[38;2;230;219;116m"Hello, {}![0m[38;2;190;132;255m\n[0m[38;2;230;219;116m"[0m[38;2;248;248;242m,[0m[38;2;248;248;242m .[0m[38;2;248;248;242m{[0m[38;2;230;219;116m"world"[0m[38;2;248;248;242m}[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;248;248;242mstd[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtesting[0m[38;2;248;248;242m.[0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m expect [0m[38;2;249;38;114m=[0m[38;2;248;248;242m std.testing.expect[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[3;38;2;102;217;239mtest[0m[38;2;248;248;242m [0m[38;2;230;219;116m"comments"[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// comments start with "//" until newline[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// foo bar baz[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mx[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m// another comment[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m x [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255mtrue[0m[38;2;248;248;242m;[0m[38;2;248;248;242m [0m[38;2;117;113;94m// another comment[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;248;248;242mx[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
@@ -25,26 +25,26 @@
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m/// number of nanoseconds past the second[0m
|
||||
[38;2;248;248;242m [0m[38;2;255;255;255mnano[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mu32[0m[38;2;248;248;242m,[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;166;226;46mSelf[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239m@This[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m Self [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;102;217;239m@This[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mpub[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46munixEpoch[0m[38;2;248;248;242m([0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mSelf[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mSelf[0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m .[0m[38;2;248;248;242mseconds[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m .[0m[38;2;248;248;242mnanos[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m .seconds [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m .nanos [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242m}[0m
|
||||
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mmy_val[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mswitch[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mstd[0m[38;2;248;248;242m.[0m[38;2;166;226;46mTarget[0m[38;2;248;248;242m.[0m[38;2;248;248;242mcurrent[0m[38;2;248;248;242m.[0m[38;2;248;248;242mos[0m[38;2;248;248;242m.[0m[38;2;248;248;242mtag[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;190;132;255m .linux[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Linux"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m my_val [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114mswitch[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242mstd.Target.current.os.tag[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;190;132;255m.linux[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;230;219;116m"Linux"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;230;219;116m"not Linux"[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;166;226;46mBook[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239menum[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mpaperback[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mhardcover[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mebook[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mpdf[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m paperback[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m hardcover[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m ebook[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m pdf[0m[38;2;248;248;242m,[0m
|
||||
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;166;226;46mTokenType[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[3;38;2;102;217;239munion[0m[38;2;248;248;242m([0m[3;38;2;102;217;239menum[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
@@ -54,54 +54,54 @@
|
||||
[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255marray_lit[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [[0m[38;2;190;132;255m4[0m[38;2;248;248;242m][0m[3;38;2;102;217;239mu8[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m .[0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;190;132;255m11[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m22[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m33[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m44[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242msentinal_lit[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [[0m[38;2;190;132;255m_[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m][0m[3;38;2;102;217;239mu8[0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m4[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m sentinal_lit [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [[0m[38;2;190;132;255m_[0m[38;2;248;248;242m:[0m[38;2;190;132;255m0[0m[38;2;248;248;242m][0m[3;38;2;102;217;239mu8[0m[38;2;248;248;242m{[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m2[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m3[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[38;2;190;132;255m4[0m[38;2;248;248;242m [0m[38;2;248;248;242m}[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[3;38;2;102;217;239mtest[0m[38;2;248;248;242m [0m[38;2;230;219;116m"address of syntax"[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Get the address of a variable:[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;255;255;255mx[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mi32[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1234[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mx_ptr[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;248;248;242mx[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m x_ptr [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;248;248;242mx[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// Dereference a pointer:[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;248;248;242mx_ptr[0m[38;2;249;38;114m.*[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255m1234[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// When you get the address of a const variable, you get a const pointer to a single item.[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;102;217;239m@TypeOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mx_ptr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mi32[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;102;217;239m@TypeOf[0m[38;2;248;248;242m([0m[38;2;248;248;242mx_ptr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mi32[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;117;113;94m// If you want to mutate the value, you'd need an address of a mutable variable:[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mvar[0m[38;2;248;248;242m [0m[38;2;255;255;255my[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mi32[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m5678[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242my_ptr[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;248;248;242my[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;102;217;239m@TypeOf[0m[38;2;248;248;242m([0m[38;2;248;248;242my_ptr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[38;2;248;248;242mi32[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242my_ptr[0m[38;2;249;38;114m.*[0m[38;2;248;248;242m [0m[38;2;249;38;114m+=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mconst[0m[38;2;248;248;242m y_ptr [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;249;38;114m&[0m[38;2;248;248;242my[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;102;217;239m@TypeOf[0m[38;2;248;248;242m([0m[38;2;248;248;242my_ptr[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;249;38;114m*[0m[3;38;2;102;217;239mi32[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m y_ptr[0m[38;2;249;38;114m.*[0m[38;2;248;248;242m [0m[38;2;249;38;114m+=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;248;248;242mexpect[0m[38;2;248;248;242m([0m[38;2;248;248;242my_ptr[0m[38;2;249;38;114m.*[0m[38;2;248;248;242m [0m[38;2;249;38;114m==[0m[38;2;248;248;242m [0m[38;2;190;132;255m5679[0m[38;2;248;248;242m)[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
||||
[38;2;117;113;94m// integer literals[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mdecimal_int[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m98222[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mhex_int[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0xff[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242manother_hex_int[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0xFF[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242moctal_int[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0o755[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mbinary_int[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0b11110000[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m decimal_int [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m98222[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m hex_int [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0xff[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m another_hex_int [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0xFF[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m octal_int [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0o755[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m binary_int [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0b11110000[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;117;113;94m// underscores may be placed between two digits as a visual separator[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mone_billion[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1_000_000_000[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mbinary_mask[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0b1_1111_1111[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mpermissions[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0o7_5_5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mbig_address[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0xFF80_0000_0000_0000[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m one_billion [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m1_000_000_000[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m binary_mask [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0b1_1111_1111[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m permissions [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0o7_5_5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m big_address [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0xFF80_0000_0000_0000[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;117;113;94m// float literals[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mfloating_point[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m123.0E+77[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242manother_float[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m123.0[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242myet_another[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m123.0e+77[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m floating_point [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m123.0E+77[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m another_float [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m123.0[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m yet_another [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m123.0e+77[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mhex_floating_point[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x103.70p-5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242manother_hex_float[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x103.70[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242myet_another_hex_float[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x103.70P-5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m hex_floating_point [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x103.70p-5[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m another_hex_float [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x103.70[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m yet_another_hex_float [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x103.70P-5[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[38;2;117;113;94m// underscores may be placed between two digits as a visual separator[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mlightspeed[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m299_792_458.000_000[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mnanosecond[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.000_000_001[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m [0m[38;2;248;248;242mmore_hex[0m[38;2;248;248;242m [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x1234_5678.9ABC_CDEFp-10[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m lightspeed [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m299_792_458.000_000[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m nanosecond [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0.000_000_001[0m[38;2;248;248;242m;[0m
|
||||
[38;2;249;38;114mconst[0m[38;2;248;248;242m more_hex [0m[38;2;249;38;114m=[0m[38;2;248;248;242m [0m[38;2;190;132;255m0x1234_5678.9ABC_CDEFp-10[0m[38;2;248;248;242m;[0m
|
||||
|
||||
[3;38;2;102;217;239mfn[0m[38;2;248;248;242m [0m[38;2;166;226;46mmax[0m[38;2;248;248;242m([0m[3;38;2;102;217;239mcomptime[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mT[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mtype[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31ma[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mT[0m[38;2;248;248;242m,[0m[38;2;248;248;242m [0m[3;38;2;253;151;31mb[0m[38;2;248;248;242m:[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mT[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[3;38;2;102;217;239mT[0m[38;2;248;248;242m [0m[38;2;248;248;242m{[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242ma[0m[38;2;248;248;242m [0m[38;2;249;38;114m>[0m[38;2;248;248;242m [0m[38;2;248;248;242mb[0m[38;2;248;248;242m)[0m[38;2;248;248;242m [0m[38;2;248;248;242ma[0m[38;2;248;248;242m [0m[38;2;249;38;114melse[0m[38;2;248;248;242m [0m[38;2;248;248;242mb[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mreturn[0m[38;2;248;248;242m [0m[38;2;249;38;114mif[0m[38;2;248;248;242m [0m[38;2;248;248;242m([0m[38;2;248;248;242ma [0m[38;2;249;38;114m>[0m[38;2;248;248;242m b[0m[38;2;248;248;242m)[0m[38;2;248;248;242m a [0m[38;2;249;38;114melse[0m[38;2;248;248;242m b[0m[38;2;248;248;242m;[0m
|
||||
[38;2;248;248;242m}[0m
|
||||
|
@@ -1,54 +0,0 @@
|
||||
[38;2;248;248;242mbat 0.20.0 (e735562-modified)[0m
|
||||
[38;2;248;248;242mA cat(1) clone with syntax highlighting and Git integration.[0m
|
||||
|
||||
[38;2;253;151;31mUSAGE:[0m
|
||||
[38;2;248;248;242m bat [OPTIONS] [FILE]...[0m
|
||||
[38;2;248;248;242m bat <SUBCOMMAND>[0m
|
||||
|
||||
[38;2;253;151;31mOPTIONS:[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-A[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--show-all[0m
|
||||
[38;2;248;248;242m Show non-printable characters (space, tab, newline, ..).[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-p[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--plain[0m[38;2;248;248;242m Show plain style (alias for '--style=plain').[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-l[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--language[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<language>[0m[38;2;248;248;242m Set the language for syntax highlighting.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-H[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--highlight-line[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<N:M>[0m[3;38;2;253;151;31m...[0m[38;2;248;248;242m Highlight lines N through M.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--file-name[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<name>[0m[3;38;2;253;151;31m...[0m[38;2;248;248;242m Specify the name to display for a file.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-d[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--diff[0m
|
||||
[38;2;248;248;242m Only show lines that have been added/removed/modified.[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--tabs[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<T>[0m[38;2;248;248;242m Set the tab width to T spaces.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--wrap[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<mode>[0m
|
||||
[38;2;248;248;242m Specify the text-wrapping mode (*auto*, never, character).[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-n[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--number[0m
|
||||
[38;2;248;248;242m Show line numbers (alias for '--style=numbers').[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--color[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<when>[0m[38;2;248;248;242m When to use colors (*auto*, never, always).[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--italic-text[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<when>[0m[38;2;248;248;242m Use italics in output (always, *never*)[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--decorations[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<when>[0m
|
||||
[38;2;248;248;242m When to show the decorations (*auto*, never, always).[0m
|
||||
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--paging[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<when>[0m
|
||||
[38;2;248;248;242m Specify when to use the pager, or use `-P` to disable (*auto*, never,[0m
|
||||
[38;2;248;248;242m always).[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-m[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--map-syntax[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<glob:syntax>[0m[3;38;2;253;151;31m...[0m
|
||||
[38;2;248;248;242m Use the specified syntax for files matching the glob pattern[0m
|
||||
[38;2;248;248;242m ('*.cpp:C++').[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--theme[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<theme>[0m[38;2;248;248;242m Set the color theme for syntax highlighting.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--list-themes[0m[38;2;248;248;242m Display all supported highlighting themes.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m--style[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<components>[0m
|
||||
[38;2;248;248;242m Comma-separated list of style elements to display (*auto*, full, plain,[0m
|
||||
[38;2;248;248;242m changes, header, grid, rule, numbers, snip).[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-r[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--line-range[0m[38;2;248;248;242m [0m[3;38;2;253;151;31m<N:M>[0m[3;38;2;253;151;31m...[0m[38;2;248;248;242m Only print the lines from N to M.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-L[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--list-languages[0m[38;2;248;248;242m Display all supported languages.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-h[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--help[0m[38;2;248;248;242m Print this help message.[0m
|
||||
[38;2;248;248;242m [0m[38;2;166;226;46m-V[0m[38;2;248;248;242m, [0m[38;2;166;226;46m--version[0m[38;2;248;248;242m Show version information.[0m
|
||||
|
||||
[38;2;253;151;31mARGS:[0m
|
||||
[38;2;248;248;242m [0m[3;38;2;253;151;31m<FILE>...[0m[38;2;248;248;242m File(s) to print / concatenate. Use '-' for standard input.[0m
|
||||
|
||||
[38;2;253;151;31mSUBCOMMANDS:[0m
|
||||
[38;2;248;248;242m [0m[38;2;249;38;114mcache[0m[38;2;248;248;242m Modify the syntax-definition and theme cache[0m
|
||||
|
||||
[38;2;248;248;242mNote: `bat -h` prints a short and concise overview while `bat --help` gives all[0m
|
||||
[38;2;248;248;242mdetails.[0m
|
5
tests/syntax-tests/source/INI/test.inf
vendored
5
tests/syntax-tests/source/INI/test.inf
vendored
@@ -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
|
25
tests/syntax-tests/source/JQ/LICENSE.md
vendored
25
tests/syntax-tests/source/JQ/LICENSE.md
vendored
@@ -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.
|
60
tests/syntax-tests/source/JQ/sample.jq
vendored
60
tests/syntax-tests/source/JQ/sample.jq
vendored
@@ -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"
|
||||
)
|
||||
|
1
tests/syntax-tests/source/Log/example.log
vendored
1
tests/syntax-tests/source/Log/example.log
vendored
@@ -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" }
|
||||
|
6
tests/syntax-tests/source/Svelte/App.svelte
vendored
6
tests/syntax-tests/source/Svelte/App.svelte
vendored
@@ -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;
|
||||
|
5
tests/syntax-tests/source/Vue/example.vue
vendored
5
tests/syntax-tests/source/Vue/example.vue
vendored
@@ -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";
|
||||
|
54
tests/syntax-tests/source/cmd-help/test.cmd-help
vendored
54
tests/syntax-tests/source/cmd-help/test.cmd-help
vendored
@@ -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.
|
Reference in New Issue
Block a user