mirror of
https://github.com/sharkdp/bat
synced 2026-08-04 19:01:44 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2596bfe7a7 | |||
| 406bffa8c8 | |||
| 48441b99ef | |||
| ce4717144a | |||
| f59d00d4c7 | |||
| dcfdbf82dd | |||
| 0cb884d501 | |||
| 7bc4020a92 | |||
| 0792195156 | |||
| 83f24ffcfb | |||
| 74ec390770 | |||
| 9014ffcfd8 | |||
| 81af375289 | |||
| d707eab95c | |||
| d64c55ef11 | |||
| 2b1d53fb27 | |||
| bf696f58c8 | |||
| 296bad8ffd | |||
| 94310af30c | |||
| 38c096bf79 | |||
| 696d1b3ed3 | |||
| 17d98724a5 | |||
| 7d7ee1b594 | |||
| 682b4209f2 | |||
| 41ddcbd240 | |||
| 48a7ce3bf2 | |||
| 3bcc4d0d55 | |||
| 8821bca656 | |||
| 56111aa20d | |||
| 5fe8a8342b | |||
| 989109145a | |||
| 23afc8e90c | |||
| 8e18786556 | |||
| 81488adf8b | |||
| e37e9c1214 | |||
| a4828387c1 | |||
| abeac8b12e | |||
| 82e7786e74 | |||
| 0064321323 | |||
| 9e622a1a5f |
+12
-3
@@ -166,9 +166,6 @@
|
|||||||
[submodule "assets/themes/Nord-sublime"]
|
[submodule "assets/themes/Nord-sublime"]
|
||||||
path = assets/themes/Nord-sublime
|
path = assets/themes/Nord-sublime
|
||||||
url = https://github.com/crabique/Nord-plist.git
|
url = https://github.com/crabique/Nord-plist.git
|
||||||
[submodule "assets/themes/solarized-sublime"]
|
|
||||||
path = assets/themes/solarized-sublime
|
|
||||||
url = https://github.com/paulcpederson/solarized-sublime.git
|
|
||||||
[submodule "assets/syntaxes/Vue"]
|
[submodule "assets/syntaxes/Vue"]
|
||||||
path = assets/syntaxes/02_Extra/Vue
|
path = assets/syntaxes/02_Extra/Vue
|
||||||
url = https://github.com/vuejs/vue-syntax-highlight.git
|
url = https://github.com/vuejs/vue-syntax-highlight.git
|
||||||
@@ -179,3 +176,15 @@
|
|||||||
[submodule "assets/syntaxes/02_Extra/Stylus"]
|
[submodule "assets/syntaxes/02_Extra/Stylus"]
|
||||||
path = assets/syntaxes/02_Extra/Stylus
|
path = assets/syntaxes/02_Extra/Stylus
|
||||||
url = https://github.com/billymoon/Stylus
|
url = https://github.com/billymoon/Stylus
|
||||||
|
[submodule "assets/themes/Solarized"]
|
||||||
|
path = assets/themes/Solarized
|
||||||
|
url = https://github.com/braver/Solarized
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Fortran"]
|
||||||
|
path = assets/syntaxes/02_Extra/Fortran
|
||||||
|
url = https://github.com/315234/SublimeFortran
|
||||||
|
[submodule "assets/syntaxes/02_Extra/Email"]
|
||||||
|
path = assets/syntaxes/02_Extra/Email
|
||||||
|
url = https://github.com/mariozaizar/email.sublime-syntax.git
|
||||||
|
[submodule "assets/syntaxes/02_Extra/QML"]
|
||||||
|
path = assets/syntaxes/02_Extra/QML
|
||||||
|
url = https://github.com/skozlovf/Sublime-QML
|
||||||
|
|||||||
+3
-3
@@ -32,15 +32,15 @@ matrix:
|
|||||||
|
|
||||||
# Minimum Rust supported channel.
|
# Minimum Rust supported channel.
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: 1.37.0
|
rust: 1.40.0
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: 1.37.0
|
rust: 1.40.0
|
||||||
env:
|
env:
|
||||||
- TARGET=x86_64-unknown-linux-musl
|
- TARGET=x86_64-unknown-linux-musl
|
||||||
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
||||||
- os: osx
|
- os: osx
|
||||||
rust: 1.37.0
|
rust: 1.40.0
|
||||||
env: TARGET=x86_64-apple-darwin
|
env: TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
# Disable nightly for now
|
# Disable nightly for now
|
||||||
|
|||||||
+38
-4
@@ -1,15 +1,49 @@
|
|||||||
# Upcoming release
|
# unreleased
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
## Other
|
## Other
|
||||||
## `bat` as a library
|
|
||||||
## New syntaxes
|
## New syntaxes
|
||||||
## New themes
|
## New themes
|
||||||
|
## `bat` as a library
|
||||||
## Packaging
|
## Packaging
|
||||||
|
|
||||||
|
# v0.15.1
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Fix highlighting of Markdown files, see #963 and #977
|
||||||
|
- Fix `base16` theme (was broken since in v0.14), see #972, #934 and #979 (@mk12).
|
||||||
|
Users suffering from #865 ("no color for bat in ssh from a Windows client") can use the `ansi-dark` and `ansi-light` themes from now on.
|
||||||
|
|
||||||
|
## New syntaxes
|
||||||
|
|
||||||
|
- Fortran, see #957
|
||||||
|
- Email (@mariozaizar)
|
||||||
|
- QML, see #962 (@pylipp)
|
||||||
|
|
||||||
|
# v0.15.0
|
||||||
|
|
||||||
|
## Features
|
||||||
|
|
||||||
|
- Add a new `--diff`/`-d` option that can be used to only show lines surrounding
|
||||||
|
Git changes, i.e. added, removed or modified lines. The amount of additional
|
||||||
|
context can be controlled with `--diff-context=N`. See #23 and #940
|
||||||
|
|
||||||
|
## Bugfixes
|
||||||
|
|
||||||
|
- Error message printed in the middle of the output for another file, see #946
|
||||||
|
- Performance improvements when using custom caches (via `bat cache --build`): the `bat` startup time should now be twice as fast (@lzutao).
|
||||||
|
|
||||||
|
## Themes
|
||||||
|
|
||||||
|
- Updated version of the Solarized dark/light themes, see #941
|
||||||
|
|
||||||
|
## `bat` as a library
|
||||||
|
|
||||||
|
- There are a few changes in the "low level" API (the `Config` struct has changed and
|
||||||
|
the error handler needs a new `&mut dyn Write` argument). The high-level API is not
|
||||||
|
affected.
|
||||||
|
|
||||||
# v0.14.0
|
# v0.14.0
|
||||||
|
|
||||||
|
|||||||
Generated
+22
-23
@@ -114,19 +114,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bat"
|
name = "bat"
|
||||||
version = "0.14.0"
|
version = "0.15.1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.12.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"assert_cmd 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"assert_cmd 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"console 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"console 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"content_inspector 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"content_inspector 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"dirs 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"git2 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"git2 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"liquid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"liquid 0.20.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -292,30 +292,20 @@ dependencies = [
|
|||||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "clicolors-control"
|
|
||||||
version = "1.0.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"atty 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.10.0"
|
version = "0.11.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"encode_unicode 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 1.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"terminal_size 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -550,12 +540,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git2"
|
name = "git2"
|
||||||
version = "0.13.3"
|
version = "0.13.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libgit2-sys 0.12.4+1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libgit2-sys 0.12.5+1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -676,7 +666,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
name = "libgit2-sys"
|
||||||
version = "0.12.4+1.0.0"
|
version = "0.12.5+1.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.52 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -1267,6 +1257,15 @@ dependencies = [
|
|||||||
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi-util 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "terminal_size"
|
||||||
|
version = "0.1.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termios"
|
name = "termios"
|
||||||
version = "0.3.2"
|
version = "0.3.2"
|
||||||
@@ -1515,8 +1514,7 @@ dependencies = [
|
|||||||
"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2"
|
"checksum chrono 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)" = "80094f509cf8b5ae86a4966a39b3ff66cd7e2a3e594accec3743ff3fabeab5b2"
|
||||||
"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
|
"checksum clang-sys 0.28.1 (registry+https://github.com/rust-lang/crates.io-index)" = "81de550971c976f176130da4b2978d3b524eaa0fd9ac31f3ceb5ae1231fb4853"
|
||||||
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
"checksum clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5067f5bb2d80ef5d68b4c87db81601f0b75bca627bc2ef76b141d7b846a3c6d9"
|
||||||
"checksum clicolors-control 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "90082ee5dcdd64dc4e9e0d37fbf3ee325419e39c0092191e0393df65518f741e"
|
"checksum console 0.11.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dea0f3e2e8d7dba335e913b97f9e1992c86c4399d54f8be1d31c8727d0652064"
|
||||||
"checksum console 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6728a28023f207181b193262711102bfbaf47cc9d13bc71d0736607ef8efe88c"
|
|
||||||
"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
"checksum constant_time_eq 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
||||||
"checksum content_inspector 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38"
|
"checksum content_inspector 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38"
|
||||||
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
"checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
|
||||||
@@ -1547,7 +1545,7 @@ dependencies = [
|
|||||||
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
"checksum fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
||||||
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
"checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec"
|
||||||
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
"checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb"
|
||||||
"checksum git2 0.13.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bdfc6e264105ef4bf1f5c9a0907f285b43ed2ede987b4876556d0478359f0a0f"
|
"checksum git2 0.13.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e1e02a51cd90229028c9bd8be0a0364f85b6b3199cccaa0ef39005ddbd5ac165"
|
||||||
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
"checksum glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
|
||||||
"checksum globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120"
|
"checksum globset 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120"
|
||||||
"checksum hermit-abi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15"
|
"checksum hermit-abi 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15"
|
||||||
@@ -1563,7 +1561,7 @@ dependencies = [
|
|||||||
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
"checksum lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
||||||
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
"checksum lazycell 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f"
|
||||||
"checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
|
"checksum libc 0.2.69 (registry+https://github.com/rust-lang/crates.io-index)" = "99e85c08494b21a9054e7fe1374a732aeadaff3980b6990b94bfd3a70f690005"
|
||||||
"checksum libgit2-sys 0.12.4+1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ef2870ecd7b50a76391b108edc2c62283ad2b62e5b1ab4d5263ef1cd04ef1c44"
|
"checksum libgit2-sys 0.12.5+1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3eadeec65514971355bf7134967a543f71372f35b53ac6c7143e7bd157f07535"
|
||||||
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
"checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753"
|
||||||
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
|
"checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
|
||||||
"checksum line-wrap 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
|
"checksum line-wrap 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
|
||||||
@@ -1634,6 +1632,7 @@ dependencies = [
|
|||||||
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
||||||
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||||
"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
|
"checksum termcolor 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f"
|
||||||
|
"checksum terminal_size 0.1.12 (registry+https://github.com/rust-lang/crates.io-index)" = "8038f95fc7a6f351163f4b964af631bd26c9e828f7db085f2a84aca56f70d13b"
|
||||||
"checksum termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2"
|
"checksum termios 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6f0fcee7b24a25675de40d5bb4de6e41b0df07bc9856295e7e2b3a3600c400c2"
|
||||||
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
"checksum textwrap 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "d326610f408c7a4eb6f51c37c330e496b08506c9457c9d34287ecc38809fb060"
|
||||||
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
|
||||||
|
|||||||
+3
-3
@@ -7,7 +7,7 @@ license = "MIT/Apache-2.0"
|
|||||||
name = "bat"
|
name = "bat"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/sharkdp/bat"
|
repository = "https://github.com/sharkdp/bat"
|
||||||
version = "0.14.0"
|
version = "0.15.1"
|
||||||
exclude = [
|
exclude = [
|
||||||
"assets/syntaxes/*",
|
"assets/syntaxes/*",
|
||||||
"assets/themes/*",
|
"assets/themes/*",
|
||||||
@@ -39,7 +39,7 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
|
|||||||
atty = { version = "0.2.14", optional = true }
|
atty = { version = "0.2.14", optional = true }
|
||||||
ansi_term = "^0.12.1"
|
ansi_term = "^0.12.1"
|
||||||
ansi_colours = "^1.0"
|
ansi_colours = "^1.0"
|
||||||
console = "0.10"
|
console = "0.11.2"
|
||||||
dirs = { version = "2.0", optional = true }
|
dirs = { version = "2.0", optional = true }
|
||||||
lazy_static = { version = "1.4", optional = true }
|
lazy_static = { version = "1.4", optional = true }
|
||||||
wild = { version = "2.0", optional = true }
|
wild = { version = "2.0", optional = true }
|
||||||
@@ -79,7 +79,7 @@ assert_cmd = "1.0.1"
|
|||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
clap = { version = "2.33", optional = true }
|
clap = { version = "2.33", optional = true }
|
||||||
liquid = { version = "0.20", optional = true }
|
liquid = { version = "0.20", optional = true }
|
||||||
lazy_static = { version = "1.4", optional = true }
|
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
lto = true
|
lto = true
|
||||||
|
codegen-units = 1
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ the most recent release of `bat`, download the latest `.deb` package from the
|
|||||||
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
[release page](https://github.com/sharkdp/bat/releases) and install it via:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.13.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.15.1_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -348,11 +348,11 @@ binaries are also available: look for archives with `musl` in the file name.
|
|||||||
|
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
If you want to build `bat` from source, you need Rust 1.37 or
|
If you want to build `bat` from source, you need Rust 1.40 or
|
||||||
higher. You can then use `cargo` to build everything:
|
higher. You can then use `cargo` to build everything:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
On some platforms, you might need to install `llvm` and/or `libclang-dev`.
|
On some platforms, you might need to install `llvm` and/or `libclang-dev`.
|
||||||
@@ -606,11 +606,11 @@ cargo build --bins
|
|||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# Install (release version)
|
||||||
cargo install
|
cargo install --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# Build a bat binary with modified syntaxes and themes
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install -f
|
cargo install --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ environment:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||||
- rustup-init.exe -y --default-host %TARGET%
|
- rustup-init.exe -y --default-host %TARGET% --profile minimal
|
||||||
- set PATH=%PATH%;C:\cargo\bin
|
- set PATH=%PATH%;C:\cargo\bin
|
||||||
- rustc -Vv
|
- rustc -Vv
|
||||||
- cargo -V
|
- cargo -V
|
||||||
|
|||||||
+168
@@ -0,0 +1,168 @@
|
|||||||
|
diff --git syntaxes/01_Packages/Markdown/Markdown.sublime-syntax syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
|
index 19dc685d..6afd87ae 100644
|
||||||
|
--- syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
|
+++ syntaxes/01_Packages/Markdown/Markdown.sublime-syntax
|
||||||
|
@@ -24,7 +24,6 @@ variables:
|
||||||
|
)
|
||||||
|
[ \t]*$ # followed by any number of tabs or spaces, followed by the end of the line
|
||||||
|
)
|
||||||
|
- setext_escape: ^(?=\s{0,3}(?:---+|===+)\s*$)
|
||||||
|
block_quote: (?:[ ]{,3}>(?:.|$)) # between 0 and 3 spaces, followed by a greater than sign, followed by any character or the end of the line
|
||||||
|
atx_heading: (?:[#]{1,6}\s*) # between 1 and 6 hashes, followed by any amount of whitespace
|
||||||
|
indented_code_block: (?:[ ]{4}|\t) # 4 spaces or a tab
|
||||||
|
@@ -277,69 +276,40 @@ contexts:
|
||||||
|
8: markup.underline.link.markdown
|
||||||
|
push: [link-ref-def, after-link-title, link-title]
|
||||||
|
- match: '^(?=\S)(?![=-]{3,}\s*$)'
|
||||||
|
- branch_point: heading2-branch
|
||||||
|
- branch:
|
||||||
|
- - not-heading2
|
||||||
|
- - heading2
|
||||||
|
-
|
||||||
|
- not-paragraph:
|
||||||
|
- - match: |-
|
||||||
|
- (?x) # pop out of this context when one of the following conditions are met:
|
||||||
|
- ^(?:
|
||||||
|
- \s*$ # the line is blank (or only contains whitespace)
|
||||||
|
- | (?=
|
||||||
|
- {{block_quote}} # a block quote begins the line
|
||||||
|
- | [ ]{,3}[*+-][ ] # an unordered list item begins the line
|
||||||
|
- | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line
|
||||||
|
- | \# # an ATX heading begins the line
|
||||||
|
- | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph
|
||||||
|
- {{html_tag_block_end_at_close_tag}} # 1
|
||||||
|
- | !-- # 2
|
||||||
|
- | \? # 3
|
||||||
|
- | ![A-Z] # 4
|
||||||
|
- | !\[CDATA\[ # 5
|
||||||
|
- | {{html_tag_block_end_at_blank_line}} # 6
|
||||||
|
+ push:
|
||||||
|
+ - meta_scope: meta.paragraph.markdown
|
||||||
|
+ - match: |-
|
||||||
|
+ (?x) # pop out of this context when one of the following conditions are met:
|
||||||
|
+ ^(?:
|
||||||
|
+ \s*$ # the line is blank (or only contains whitespace)
|
||||||
|
+ | (?=
|
||||||
|
+ {{block_quote}} # a block quote begins the line
|
||||||
|
+ | [ ]{,3}[*+-][ ] # an unordered list item begins the line
|
||||||
|
+ | [ ]{,3}1[.][ ] # an ordered list item with number "1" begins the line
|
||||||
|
+ | \# # an ATX heading begins the line
|
||||||
|
+ | [ ]{,3}<( # all types of HTML blocks except type 7 may interrupt a paragraph
|
||||||
|
+ {{html_tag_block_end_at_close_tag}} # 1
|
||||||
|
+ | !-- # 2
|
||||||
|
+ | \? # 3
|
||||||
|
+ | ![A-Z] # 4
|
||||||
|
+ | !\[CDATA\[ # 5
|
||||||
|
+ | {{html_tag_block_end_at_blank_line}} # 6
|
||||||
|
+ )
|
||||||
|
)
|
||||||
|
)
|
||||||
|
- )
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
- not-heading2:
|
||||||
|
- - include: not-paragraph
|
||||||
|
- - match: (?=\S)
|
||||||
|
- branch_point: heading1-branch
|
||||||
|
- branch:
|
||||||
|
- - paragraph
|
||||||
|
- - heading1
|
||||||
|
- - match: ''
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
- paragraph:
|
||||||
|
- - meta_scope: meta.paragraph.markdown
|
||||||
|
- - match: ^\s{0,3}===+\s*$
|
||||||
|
- fail: heading1-branch
|
||||||
|
- - match: ^\s{0,3}---+\s*$
|
||||||
|
- fail: heading2-branch
|
||||||
|
- - include: not-paragraph
|
||||||
|
- - include: inline-bold-italic-linebreak
|
||||||
|
- - include: scope:text.html.basic
|
||||||
|
-
|
||||||
|
- heading1:
|
||||||
|
- - meta_scope: markup.heading.1.markdown
|
||||||
|
- - include: inline-bold-italic-linebreak
|
||||||
|
- - match: '^[ \t]{0,3}(={3,})(?=[ \t]*$)'
|
||||||
|
- captures:
|
||||||
|
- 1: markup.heading.1.setext.markdown punctuation.definition.heading.setext.markdown
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
- heading2:
|
||||||
|
- - meta_scope: markup.heading.2.markdown
|
||||||
|
- - include: inline-bold-italic-linebreak
|
||||||
|
- - match: '^[ \t]{0,3}(-{3,})(?=[ \t]*$)'
|
||||||
|
- captures:
|
||||||
|
- 1: markup.heading.2.setext.markdown punctuation.definition.heading.setext.markdown
|
||||||
|
- pop: true
|
||||||
|
-
|
||||||
|
+ pop: true
|
||||||
|
+ - include: inline-bold-italic-linebreak
|
||||||
|
+ - include: scope:text.html.basic
|
||||||
|
+ - match: '^(={3,})(?=[ \t]*$)'
|
||||||
|
+ scope: markup.heading.1.setext.markdown
|
||||||
|
+ captures:
|
||||||
|
+ 1: punctuation.definition.heading.setext.markdown
|
||||||
|
+ pop: true
|
||||||
|
+ - match: '^(-{3,})(?=[ \t]*$)'
|
||||||
|
+ scope: markup.heading.2.setext.markdown
|
||||||
|
+ captures:
|
||||||
|
+ 1: punctuation.definition.heading.setext.markdown
|
||||||
|
+ pop: true
|
||||||
|
link-ref-def:
|
||||||
|
- meta_scope: meta.link.reference.def.markdown
|
||||||
|
- match: ''
|
||||||
|
@@ -430,8 +400,6 @@ contexts:
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.bold.markdown
|
||||||
|
- meta_content_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -446,8 +414,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.bold.end.markdown
|
||||||
|
set:
|
||||||
|
- meta_content_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -463,8 +429,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.italic.end.markdown
|
||||||
|
set:
|
||||||
|
- meta_content_scope: markup.bold.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{3,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -727,8 +691,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.italic.begin.markdown
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*\*{4,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -745,8 +707,6 @@ contexts:
|
||||||
|
scope: punctuation.definition.italic.begin.markdown
|
||||||
|
push:
|
||||||
|
- meta_scope: markup.italic.markdown
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: |-
|
||||||
|
(?x)
|
||||||
|
[ \t]*_{4,} # if there are more than 3 its not applicable to be bold or italic
|
||||||
|
@@ -773,8 +733,6 @@ contexts:
|
||||||
|
- include: bold-italic-trailing
|
||||||
|
bold-italic-trailing:
|
||||||
|
- include: scope:text.html.basic
|
||||||
|
- - match: '{{setext_escape}}'
|
||||||
|
- pop: true
|
||||||
|
- match: ^\s*$\n?
|
||||||
|
scope: invalid.illegal.non-terminated.bold-italic.markdown
|
||||||
|
pop: true
|
||||||
Vendored
BIN
Binary file not shown.
+1
Submodule assets/syntaxes/02_Extra/Email added at fc034fb85a
+1
Submodule assets/syntaxes/02_Extra/Fortran added at dcf4f24f1c
+1
Submodule assets/syntaxes/02_Extra/QML added at e3e058a21f
+103
@@ -0,0 +1,103 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: QML
|
||||||
|
file_extensions:
|
||||||
|
- qml
|
||||||
|
- qmlproject
|
||||||
|
scope: source.qml
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: /\*(?!/)
|
||||||
|
comment: Block comment.
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.documentation.qml
|
||||||
|
- match: \*/
|
||||||
|
pop: true
|
||||||
|
- match: //.*$
|
||||||
|
comment: Line comment.
|
||||||
|
scope: comment.line.double-slash.qml
|
||||||
|
- match: \b(import)\s+
|
||||||
|
comment: import statement.
|
||||||
|
captures:
|
||||||
|
1: keyword.other.import.qml
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.import.qml
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: '([\w\d\.]+)\s+(\d+\.\d+)(?:\s+(as)\s+([A-Z][\w\d]*))?'
|
||||||
|
comment: "import Namespace VersionMajor.VersionMinor [as SingletonTypeIdentifier]"
|
||||||
|
scope: meta.import.namespace.qml
|
||||||
|
captures:
|
||||||
|
1: entity.name.class.qml
|
||||||
|
2: constant.numeric.qml
|
||||||
|
3: keyword.other.import.qml
|
||||||
|
4: entity.name.class.qml
|
||||||
|
- match: '(\"[^\"]+\")(?:\s+(as)\s+([A-Z][\w\d]*))?'
|
||||||
|
comment: "import <string> [as Script]"
|
||||||
|
scope: meta.import.dirjs.qml
|
||||||
|
captures:
|
||||||
|
1: string.quoted.double.qml
|
||||||
|
2: keyword.other.import.qml
|
||||||
|
3: entity.name.class.qml
|
||||||
|
- match: '\b[A-Z]\w*\b'
|
||||||
|
comment: Capitalized word (class or enum).
|
||||||
|
scope: support.class.qml
|
||||||
|
- match: '(((^|\{)\s*)|\b)on[A-Z]\w*\b'
|
||||||
|
comment: onSomething - handler.
|
||||||
|
scope: support.class.qml
|
||||||
|
- match: '(?:^|\{)\s*(id)\s*\:\s*([^;\s]+)\b'
|
||||||
|
comment: "id: <something>"
|
||||||
|
scope: meta.id.qml
|
||||||
|
captures:
|
||||||
|
1: keyword.other.qml
|
||||||
|
2: storage.modifier.qml
|
||||||
|
- match: '^\s*(?:(default|readonly)\s+)?(property)\s+(?:(alias)|([\w\<\>]+))\s+(\w+)'
|
||||||
|
comment: property definition.
|
||||||
|
scope: meta.propertydef.qml
|
||||||
|
captures:
|
||||||
|
1: keyword.other.qml
|
||||||
|
2: keyword.other.qml
|
||||||
|
3: keyword.other.qml
|
||||||
|
4: storage.type.qml
|
||||||
|
5: entity.other.attribute-name.qml
|
||||||
|
- match: \b(signal)\s+(\w+)\s*
|
||||||
|
comment: "signal <signalName>[([<type> <parameter>[, ...]])]"
|
||||||
|
captures:
|
||||||
|
1: keyword.other.qml
|
||||||
|
2: support.function.qml
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.signal.qml
|
||||||
|
- match: ;|(?=/)|$
|
||||||
|
pop: true
|
||||||
|
- match: (\w+)\s+(\w+)
|
||||||
|
scope: meta.signal.parameters.qml
|
||||||
|
captures:
|
||||||
|
1: storage.type.qml
|
||||||
|
2: variable.parameter.qml
|
||||||
|
- match: (?:\b|\s+)(?:(true|false|null|undefined)|(var|void)|(on|as|enum|connect|break|case|catch|continue|debugger|default|delete|do|else|finally|for|if|in|instanceof|new|return|switch|this|throw|try|typeof|while|with))\b
|
||||||
|
comment: js keywords.
|
||||||
|
scope: meta.keyword.qml
|
||||||
|
captures:
|
||||||
|
1: constant.language.qml
|
||||||
|
2: storage.type.qml
|
||||||
|
3: keyword.control.qml
|
||||||
|
- match: '\b(function)\s+([\w_]+)\s*(?=\()'
|
||||||
|
comment: function definition.
|
||||||
|
scope: meta.function.qml
|
||||||
|
captures:
|
||||||
|
1: storage.type.qml
|
||||||
|
2: entity.name.function.untitled
|
||||||
|
- match: '\b[\w_]+\s*(?=\()'
|
||||||
|
comment: function call.
|
||||||
|
scope: support.function.qml
|
||||||
|
- match: '(?:^|\{|;)\s*[a-z][\w\.]*\s*(?=\:)'
|
||||||
|
comment: "property (property: <something>)."
|
||||||
|
scope: entity.other.attribute-name.qml
|
||||||
|
- match: (?<=\.)\b\w*
|
||||||
|
comment: property of the variable (name.property).
|
||||||
|
scope: entity.other.attribute-name.qml
|
||||||
|
- match: '\b([a-z_]\w*)\b'
|
||||||
|
comment: All non colored words are assumed to be variables.
|
||||||
|
scope: variable.parameter
|
||||||
|
- include: scope:source.js
|
||||||
Vendored
BIN
Binary file not shown.
+1
Submodule assets/themes/Solarized added at 87e01090cf
Vendored
+59
-59
@@ -3,8 +3,8 @@
|
|||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<!--
|
<!--
|
||||||
The colors in this theme are encoded as #RRGGBBAA where RR is an base16
|
The colors in this theme are encoded as #RRGGBBAA where RR is an ANSI
|
||||||
color number from 00 to 0f, and AA is the special value 0f to indicate
|
palette number from 00 to 0f, and AA is the special value 00 to indicate
|
||||||
that this encoding is being used.
|
that this encoding is being used.
|
||||||
-->
|
-->
|
||||||
<key>author</key>
|
<key>author</key>
|
||||||
@@ -19,21 +19,21 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>background</key>
|
<key>background</key>
|
||||||
<string>#0000000f</string>
|
<string>#00000000</string>
|
||||||
<key>caret</key>
|
<key>caret</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
<key>invisibles</key>
|
<key>invisibles</key>
|
||||||
<string>#0800000f</string>
|
<string>#08000000</string>
|
||||||
<key>lineHighlight</key>
|
<key>lineHighlight</key>
|
||||||
<string>#0800000f</string>
|
<string>#08000000</string>
|
||||||
<key>selection</key>
|
<key>selection</key>
|
||||||
<string>#0b00000f</string>
|
<string>#0b000000</string>
|
||||||
<key>gutter</key>
|
<key>gutter</key>
|
||||||
<string>#0a00000f</string>
|
<string>#0a000000</string>
|
||||||
<key>gutterForeground</key>
|
<key>gutterForeground</key>
|
||||||
<string>#0800000f</string>
|
<string>#08000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0800000f</string>
|
<string>#08000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -77,7 +77,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0500000f</string>
|
<string>#05000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -110,7 +110,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -121,7 +121,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0400000f</string>
|
<string>#04000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -132,7 +132,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0e00000f</string>
|
<string>#0e000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -143,7 +143,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0300000f</string>
|
<string>#03000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -154,7 +154,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0f00000f</string>
|
<string>#0f000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -165,7 +165,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0400000f</string>
|
<string>#04000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -176,7 +176,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0500000f</string>
|
<string>#05000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -187,7 +187,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0600000f</string>
|
<string>#06000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -198,7 +198,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0200000f</string>
|
<string>#02000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -209,7 +209,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -220,7 +220,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -231,7 +231,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -242,7 +242,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0100000f</string>
|
<string>#01000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -264,7 +264,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -275,7 +275,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0400000f</string>
|
<string>#04000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -286,7 +286,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0500000f</string>
|
<string>#05000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -297,7 +297,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -310,7 +310,7 @@
|
|||||||
<key>fontStyle</key>
|
<key>fontStyle</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0400000f</string>
|
<string>#04000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -321,7 +321,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -334,7 +334,7 @@
|
|||||||
<key>fontStyle</key>
|
<key>fontStyle</key>
|
||||||
<string>bold</string>
|
<string>bold</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0300000f</string>
|
<string>#03000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -347,7 +347,7 @@
|
|||||||
<key>fontStyle</key>
|
<key>fontStyle</key>
|
||||||
<string>italic</string>
|
<string>italic</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0500000f</string>
|
<string>#05000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0200000f</string>
|
<string>#02000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -369,7 +369,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0100000f</string>
|
<string>#01000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -380,7 +380,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -391,7 +391,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -402,9 +402,9 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>background</key>
|
<key>background</key>
|
||||||
<string>#0b00000f</string>
|
<string>#0b000000</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0700000f</string>
|
<string>#07000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -415,7 +415,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0200000f</string>
|
<string>#02000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -426,7 +426,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0100000f</string>
|
<string>#01000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -437,7 +437,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0500000f</string>
|
<string>#05000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -448,7 +448,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0600000f</string>
|
<string>#06000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -459,7 +459,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0600000f</string>
|
<string>#06000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -470,7 +470,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0600000f</string>
|
<string>#06000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -481,7 +481,7 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0500000f</string>
|
<string>#05000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -492,9 +492,9 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>background</key>
|
<key>background</key>
|
||||||
<string>#0100000f</string>
|
<string>#01000000</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0f00000f</string>
|
<string>#0f000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -505,9 +505,9 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>background</key>
|
<key>background</key>
|
||||||
<string>#0900000f</string>
|
<string>#09000000</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0000000f</string>
|
<string>#00000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -518,9 +518,9 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>background</key>
|
<key>background</key>
|
||||||
<string>#0e00000f</string>
|
<string>#0e000000</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0f00000f</string>
|
<string>#0f000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
@@ -531,9 +531,9 @@
|
|||||||
<key>settings</key>
|
<key>settings</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>background</key>
|
<key>background</key>
|
||||||
<string>#0800000f</string>
|
<string>#08000000</string>
|
||||||
<key>foreground</key>
|
<key>foreground</key>
|
||||||
<string>#0f00000f</string>
|
<string>#0f000000</string>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
|
|||||||
Vendored
-1
Submodule assets/themes/solarized-sublime deleted from 1394cf0f5f
@@ -12,16 +12,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
use std::fs;
|
use std::fs;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use lazy_static::lazy_static;
|
|
||||||
|
|
||||||
// Read environment variables.
|
// Read environment variables.
|
||||||
lazy_static! {
|
let project_name = option_env!("PROJECT_NAME").unwrap_or("bat");
|
||||||
static ref PROJECT_NAME: &'static str = option_env!("PROJECT_NAME").unwrap_or("bat");
|
let executable_name = option_env!("PROJECT_EXECUTABLE").unwrap_or(project_name);
|
||||||
static ref PROJECT_VERSION: &'static str = option_env!("CARGO_PKG_VERSION").unwrap();
|
static PROJECT_VERSION: &str = env!("CARGO_PKG_VERSION");
|
||||||
static ref EXECUTABLE_NAME: &'static str = option_env!("PROJECT_EXECUTABLE")
|
|
||||||
.or(option_env!("PROJECT_NAME"))
|
|
||||||
.unwrap_or("bat");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Generates a file from a liquid template.
|
/// Generates a file from a liquid template.
|
||||||
fn template(
|
fn template(
|
||||||
@@ -38,16 +32,16 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
let variables = liquid::object!({
|
let variables = liquid::object!({
|
||||||
"PROJECT_NAME": PROJECT_NAME.to_owned(),
|
"PROJECT_NAME": project_name,
|
||||||
"PROJECT_EXECUTABLE": EXECUTABLE_NAME.to_owned(),
|
"PROJECT_EXECUTABLE": executable_name,
|
||||||
"PROJECT_VERSION": PROJECT_VERSION.to_owned(),
|
"PROJECT_VERSION": PROJECT_VERSION,
|
||||||
});
|
});
|
||||||
|
|
||||||
let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
|
let out_dir_env = std::env::var_os("OUT_DIR").expect("OUT_DIR to be set in build.rs");
|
||||||
let out_dir = Path::new(&out_dir_env);
|
let out_dir = Path::new(&out_dir_env);
|
||||||
|
|
||||||
std::fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
|
fs::create_dir_all(out_dir.join("assets/manual")).unwrap();
|
||||||
std::fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
|
fs::create_dir_all(out_dir.join("assets/completions")).unwrap();
|
||||||
|
|
||||||
template(
|
template(
|
||||||
&variables,
|
&variables,
|
||||||
|
|||||||
+56
-14
@@ -7,6 +7,20 @@ set -o pipefail
|
|||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
export LANG=C
|
export LANG=C
|
||||||
|
|
||||||
|
BAT="bat"
|
||||||
|
if ! command -v bat &>/dev/null; then
|
||||||
|
if command -v batcat &> /dev/null; then
|
||||||
|
BAT="batcat"
|
||||||
|
else
|
||||||
|
tput setaf 1
|
||||||
|
printf "%s\n%s\n" \
|
||||||
|
"Unable to find a bat executable on your PATH." \
|
||||||
|
"Please ensure that 'bat' exists and is not named something else."
|
||||||
|
tput sgr0
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Modules:
|
# Modules:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
@@ -41,33 +55,42 @@ _tool_:description() {
|
|||||||
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
||||||
_bat_:run() {
|
_bat_:run() {
|
||||||
_out bat --version
|
_out "$BAT" --version
|
||||||
_out env | grep '^BAT_\|^PAGER='
|
_out env | grep '^BAT_\|^PAGER='
|
||||||
|
|
||||||
local cache_dir="$(bat --cache-dir)"
|
local cache_dir="$(bat --cache-dir)"
|
||||||
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
|
if [[ -f "${cache_dir}/syntaxes.bin" ]]; then
|
||||||
_print_command "bat" "--list-languages"
|
_print_command "$BAT" "--list-languages"
|
||||||
echo "Found custom syntax set."
|
echo "Found custom syntax set."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -f "${cache_dir}/themes.bin" ]]; then
|
if [[ -f "${cache_dir}/themes.bin" ]]; then
|
||||||
_print_command "bat" "--list-themes"
|
_print_command "$BAT" "--list-themes"
|
||||||
echo "Found custom theme set."
|
echo "Found custom theme set."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_config_:run() {
|
_bat_config_:run() {
|
||||||
if [[ -f "$(bat --config-file)" ]]; then
|
if [[ -f "$("$BAT" --config-file)" ]]; then
|
||||||
_out_fence cat "$(bat --config-file)"
|
_out_fence cat "$("$BAT" --config-file)"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_wrapper_:run() {
|
_bat_wrapper_:run() {
|
||||||
if file "$(which bat)" | grep "text executable" &> /dev/null; then
|
_bat_wrapper_:detect_wrapper() {
|
||||||
_out_fence cat "$(which bat)"
|
local bat="$1"
|
||||||
return
|
if file "$(which "${bat}")" | grep "text executable" &> /dev/null; then
|
||||||
|
_out_fence cat "$(which "${bat}")"
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
printf "\nNo wrapper script for '%s'.\n" "${bat}"
|
||||||
|
}
|
||||||
|
|
||||||
|
_bat_wrapper_:detect_wrapper bat
|
||||||
|
if [[ "$BAT" != "bat" ]]; then
|
||||||
|
_bat_wrapper_:detect_wrapper "$BAT"
|
||||||
fi
|
fi
|
||||||
printf "\nNo wrapper script.\n"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_bat_wrapper_function_:run() {
|
_bat_wrapper_function_:run() {
|
||||||
@@ -75,17 +98,17 @@ _bat_wrapper_function_:run() {
|
|||||||
local command="$1"
|
local command="$1"
|
||||||
case "$("$SHELL" --version | head -n 1)" in
|
case "$("$SHELL" --version | head -n 1)" in
|
||||||
*fish*)
|
*fish*)
|
||||||
if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &>/dev/null; then
|
if "$SHELL" --login -i -c "type ${command}" 2>&1 | grep 'function' &> /dev/null; then
|
||||||
_out_fence "$SHELL" --login -i -c "functions ${command}"
|
_out_fence "$SHELL" --login -i -c "functions ${command}"
|
||||||
return
|
return
|
||||||
fi ;;
|
fi ;;
|
||||||
|
|
||||||
*bash*|*zsh*)
|
*bash* | *zsh*)
|
||||||
local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
local type="$("$SHELL" --login -i -c "type ${command}" 2>&1)"
|
||||||
if grep 'function' <<< "$type" &>/dev/null; then
|
if grep 'function' <<< "$type" &> /dev/null; then
|
||||||
_out_fence "$SHELL" --login -i -c "declare -f ${command}"
|
_out_fence "$SHELL" --login -i -c "declare -f ${command}"
|
||||||
return
|
return
|
||||||
elif grep 'alias' <<< "$type" &>/dev/null; then
|
elif grep 'alias' <<< "$type" &> /dev/null; then
|
||||||
_out_fence "$SHELL" --login -i -c "type ${command}"
|
_out_fence "$SHELL" --login -i -c "type ${command}"
|
||||||
return
|
return
|
||||||
fi ;;
|
fi ;;
|
||||||
@@ -99,6 +122,9 @@ _bat_wrapper_function_:run() {
|
|||||||
|
|
||||||
_bat_wrapper_function_:detect_wrapper bat
|
_bat_wrapper_function_:detect_wrapper bat
|
||||||
_bat_wrapper_function_:detect_wrapper cat
|
_bat_wrapper_function_:detect_wrapper cat
|
||||||
|
if [[ "$BAT" != "bat" ]]; then
|
||||||
|
_bat_wrapper_function_:detect_wrapper "$BAT"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
_system_:run() {
|
_system_:run() {
|
||||||
@@ -169,7 +195,8 @@ EOF
|
|||||||
declare -f "_$1_:run" \
|
declare -f "_$1_:run" \
|
||||||
| sed 's/^ *//; s/;$//' \
|
| sed 's/^ *//; s/;$//' \
|
||||||
| grep '^_out[^ ]* ' \
|
| grep '^_out[^ ]* ' \
|
||||||
| sed 's/^_out[^ ]* //' 1>&2
|
| sed 's/^_out[^ ]* //' \
|
||||||
|
| sed "s/\"\$BAT\"/$BAT/" 1>&2
|
||||||
|
|
||||||
# Prompt
|
# Prompt
|
||||||
printf "\n" 1>&2
|
printf "\n" 1>&2
|
||||||
@@ -196,6 +223,21 @@ _run_module() {
|
|||||||
# Functions:
|
# Functions:
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
# Tell the user if their executable isn't named "bat".
|
||||||
|
if [[ "$BAT" != "bat" ]] && [[ "$1" != '-y' ]]; then
|
||||||
|
trap '_tput rmcup; exit 1' INT
|
||||||
|
_tput smcup
|
||||||
|
_tput clear
|
||||||
|
_tput cup 0 0
|
||||||
|
_tput setaf 1
|
||||||
|
printf "The %s executable on your system is named '%s'.\n%s\n" "bat" "$BAT" \
|
||||||
|
"If your issue is related to installation, please check that this isn't the issue."
|
||||||
|
_tput sgr0
|
||||||
|
printf "Press any key to continue...\n"
|
||||||
|
read -rsn1
|
||||||
|
_tput rmcup
|
||||||
|
fi
|
||||||
|
|
||||||
# Ask for consent.
|
# Ask for consent.
|
||||||
if [[ "$1" == '-y' ]]; then
|
if [[ "$1" == '-y' ]]; then
|
||||||
_modules_consented=("${_modules[@]}")
|
_modules_consented=("${_modules[@]}")
|
||||||
|
|||||||
+4
-4
@@ -180,7 +180,7 @@ apt install bat
|
|||||||
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
batの最新リリースを実行する場合、または Ubuntu/Debian の古いバージョンを使用している場合は、[release page](https://github.com/sharkdp/bat/releases) から最新の `.deb` パッケージをダウンロードし、
|
||||||
次の方法でインストールします:
|
次の方法でインストールします:
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.13.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.15.1_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -345,7 +345,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
そして `cargo` をビルドに対して使用します:
|
そして `cargo` をビルドに対して使用します:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
一部のプラットフォームでは `llvm` および/または `libclang-dev` のインストールが必要になる場合があります。
|
一部のプラットフォームでは `llvm` および/または `libclang-dev` のインストールが必要になる場合があります。
|
||||||
@@ -594,11 +594,11 @@ cargo build --bins
|
|||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# Install (release version)
|
||||||
cargo install
|
cargo install --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# Build a bat binary with modified syntaxes and themes
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install -f
|
cargo install --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
## Maintainers
|
## Maintainers
|
||||||
|
|||||||
+4
-4
@@ -170,7 +170,7 @@ apt install bat
|
|||||||
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
만약 최근 릴리즈된 bat을 사용을 원하거나 buntu/Debian 예전 버전을 사용하는 경우, [릴리즈 페이지](https://github.com/sharkdp/bat/releases)에서 다음과 같이 `.deb` 패키지를 받아 설치 할 수도 있습니다:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
sudo dpkg -i bat_0.13.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.15.1_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Alpine Linux
|
### On Alpine Linux
|
||||||
@@ -327,7 +327,7 @@ ansible-galaxy install aeimer.install_bat
|
|||||||
`bat`의 소스를 직접 빌드하기 위해서는, Rust 1.36 이상이 필요하며 `cargo`를 이용해 빌드할 수 있습니다.
|
`bat`의 소스를 직접 빌드하기 위해서는, Rust 1.36 이상이 필요하며 `cargo`를 이용해 빌드할 수 있습니다.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install --locked bat
|
||||||
```
|
```
|
||||||
|
|
||||||
일부 플랫폼에서는 `llvm` 그리고/또는 `libclang-dev` 설치가 필요할 수도 있습니다.
|
일부 플랫폼에서는 `llvm` 그리고/또는 `libclang-dev` 설치가 필요할 수도 있습니다.
|
||||||
@@ -528,11 +528,11 @@ cargo build --bins
|
|||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# Install (release version)
|
||||||
cargo install
|
cargo install --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# Build a bat binary with modified syntaxes and themes
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install -f
|
cargo install --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
## 메인테이너들
|
## 메인테이너들
|
||||||
|
|||||||
+3
-3
@@ -180,7 +180,7 @@ impl HighlightingAssets {
|
|||||||
theme
|
theme
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
&self.theme_set.themes[self.fallback_theme.unwrap_or(Self::default_theme())]
|
&self.theme_set.themes[self.fallback_theme.unwrap_or_else(|| Self::default_theme())]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,7 +204,7 @@ impl HighlightingAssets {
|
|||||||
let path = Path::new(path_str);
|
let path = Path::new(path_str);
|
||||||
let line_syntax = self.get_first_line_syntax(&mut input.reader);
|
let line_syntax = self.get_first_line_syntax(&mut input.reader);
|
||||||
|
|
||||||
let absolute_path = path.canonicalize().ok().unwrap_or(path.to_owned());
|
let absolute_path = path.canonicalize().ok().unwrap_or_else(|| path.to_owned());
|
||||||
match mapping.get_syntax_for(absolute_path) {
|
match mapping.get_syntax_for(absolute_path) {
|
||||||
Some(MappingTarget::MapTo(syntax_name)) => {
|
Some(MappingTarget::MapTo(syntax_name)) => {
|
||||||
// TODO: we should probably return an error here if this syntax can not be
|
// TODO: we should probably return an error here if this syntax can not be
|
||||||
@@ -221,7 +221,7 @@ impl HighlightingAssets {
|
|||||||
OpenedInputKind::StdIn | OpenedInputKind::CustomReader => {
|
OpenedInputKind::StdIn | OpenedInputKind::CustomReader => {
|
||||||
if let Some(ref name) = input.metadata.user_provided_name {
|
if let Some(ref name) = input.metadata.user_provided_name {
|
||||||
self.get_extension_syntax(&name)
|
self.get_extension_syntax(&name)
|
||||||
.or(self.get_first_line_syntax(&mut input.reader))
|
.or_else(|| self.get_first_line_syntax(&mut input.reader))
|
||||||
} else {
|
} else {
|
||||||
self.get_first_line_syntax(&mut input.reader)
|
self.get_first_line_syntax(&mut input.reader)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ pub struct AssetsMetadata {
|
|||||||
creation_time: Option<SystemTime>,
|
creation_time: Option<SystemTime>,
|
||||||
}
|
}
|
||||||
|
|
||||||
const FILENAME: &'static str = "metadata.yaml";
|
const FILENAME: &str = "metadata.yaml";
|
||||||
|
|
||||||
impl AssetsMetadata {
|
impl AssetsMetadata {
|
||||||
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
|
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
|
||||||
|
|||||||
+26
-16
@@ -15,7 +15,7 @@ use console::Term;
|
|||||||
|
|
||||||
use bat::{
|
use bat::{
|
||||||
assets::HighlightingAssets,
|
assets::HighlightingAssets,
|
||||||
config::Config,
|
config::{Config, VisibleLines},
|
||||||
error::*,
|
error::*,
|
||||||
input::Input,
|
input::Input,
|
||||||
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
line_range::{HighlightedLineRanges, LineRange, LineRanges},
|
||||||
@@ -80,7 +80,7 @@ impl App {
|
|||||||
let paging_mode = match self.matches.value_of("paging") {
|
let paging_mode = match self.matches.value_of("paging") {
|
||||||
Some("always") => PagingMode::Always,
|
Some("always") => PagingMode::Always,
|
||||||
Some("never") => PagingMode::Never,
|
Some("never") => PagingMode::Never,
|
||||||
Some("auto") | _ => {
|
Some("auto") | None => {
|
||||||
if self.matches.occurrences_of("plain") > 1 {
|
if self.matches.occurrences_of("plain") > 1 {
|
||||||
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
// If we have -pp as an option when in auto mode, the pager should be disabled.
|
||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
@@ -99,6 +99,7 @@ impl App {
|
|||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => unreachable!("other values for --paging are not allowed"),
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut syntax_mapping = SyntaxMapping::builtin();
|
let mut syntax_mapping = SyntaxMapping::builtin();
|
||||||
@@ -147,13 +148,14 @@ impl App {
|
|||||||
match self.matches.value_of("wrap") {
|
match self.matches.value_of("wrap") {
|
||||||
Some("character") => WrappingMode::Character,
|
Some("character") => WrappingMode::Character,
|
||||||
Some("never") => WrappingMode::NoWrapping,
|
Some("never") => WrappingMode::NoWrapping,
|
||||||
Some("auto") | _ => {
|
Some("auto") | None => {
|
||||||
if style_components.plain() {
|
if style_components.plain() {
|
||||||
WrappingMode::NoWrapping
|
WrappingMode::NoWrapping
|
||||||
} else {
|
} else {
|
||||||
WrappingMode::Character
|
WrappingMode::Character
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
_ => unreachable!("other values for --paging are not allowed"),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// We don't have the tty width when piping to another program.
|
// We don't have the tty width when piping to another program.
|
||||||
@@ -196,13 +198,23 @@ impl App {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| String::from(HighlightingAssets::default_theme())),
|
.unwrap_or_else(|| String::from(HighlightingAssets::default_theme())),
|
||||||
line_ranges: self
|
visible_lines: if self.matches.is_present("diff") {
|
||||||
.matches
|
VisibleLines::DiffContext(
|
||||||
.values_of("line-range")
|
self.matches
|
||||||
.map(|vs| vs.map(LineRange::from).collect())
|
.value_of("diff-context")
|
||||||
.transpose()?
|
.and_then(|t| t.parse().ok())
|
||||||
.map(LineRanges::from)
|
.unwrap_or(2),
|
||||||
.unwrap_or_default(),
|
)
|
||||||
|
} else {
|
||||||
|
VisibleLines::Ranges(
|
||||||
|
self.matches
|
||||||
|
.values_of("line-range")
|
||||||
|
.map(|vs| vs.map(LineRange::from).collect())
|
||||||
|
.transpose()?
|
||||||
|
.map(LineRanges::from)
|
||||||
|
.unwrap_or_default(),
|
||||||
|
)
|
||||||
|
},
|
||||||
style_components,
|
style_components,
|
||||||
syntax_mapping,
|
syntax_mapping,
|
||||||
pager: self.matches.value_of("pager"),
|
pager: self.matches.value_of("pager"),
|
||||||
@@ -238,19 +250,17 @@ impl App {
|
|||||||
.map(|values| values.collect());
|
.map(|values| values.collect());
|
||||||
|
|
||||||
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
let mut filenames_or_none: Box<dyn Iterator<Item = _>> = match filenames {
|
||||||
Some(ref filenames) => {
|
Some(ref filenames) => Box::new(filenames.iter().map(|name| Some(OsStr::new(*name)))),
|
||||||
Box::new(filenames.into_iter().map(|name| Some(OsStr::new(*name))))
|
|
||||||
}
|
|
||||||
None => Box::new(std::iter::repeat(None)),
|
None => Box::new(std::iter::repeat(None)),
|
||||||
};
|
};
|
||||||
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
let files: Option<Vec<&OsStr>> = self.matches.values_of_os("FILE").map(|vs| vs.collect());
|
||||||
|
|
||||||
if files.is_none() {
|
if files.is_none() {
|
||||||
let input = Input::stdin().with_name(filenames_or_none.nth(0).unwrap_or(None));
|
let input = Input::stdin().with_name(filenames_or_none.next().unwrap_or(None));
|
||||||
return Ok(vec![input]);
|
return Ok(vec![input]);
|
||||||
}
|
}
|
||||||
let files_or_none: Box<dyn Iterator<Item = _>> = match files {
|
let files_or_none: Box<dyn Iterator<Item = _>> = match files {
|
||||||
Some(ref files) => Box::new(files.into_iter().map(|name| Some(*name))),
|
Some(ref files) => Box::new(files.iter().map(|name| Some(*name))),
|
||||||
None => Box::new(std::iter::repeat(None)),
|
None => Box::new(std::iter::repeat(None)),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -264,7 +274,7 @@ impl App {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Ok(file_input);
|
Ok(file_input)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn style_components(&self) -> Result<StyleComponents> {
|
fn style_components(&self) -> Result<StyleComponents> {
|
||||||
|
|||||||
@@ -53,5 +53,6 @@ pub fn assets_from_cache_or_binary() -> Result<HighlightingAssets> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(HighlightingAssets::from_cache(&cache_dir).unwrap_or(HighlightingAssets::from_binary()))
|
Ok(HighlightingAssets::from_cache(&cache_dir)
|
||||||
|
.unwrap_or_else(|_| HighlightingAssets::from_binary()))
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-1
@@ -105,6 +105,35 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
data to bat from STDIN when bat does not otherwise know \
|
data to bat from STDIN when bat does not otherwise know \
|
||||||
the filename."),
|
the filename."),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("diff")
|
||||||
|
.long("diff")
|
||||||
|
.short("d")
|
||||||
|
.help("Only show lines that have been added/removed/modified.")
|
||||||
|
.long_help(
|
||||||
|
"Only show lines that have been added/removed/modified with respect \
|
||||||
|
to the Git index. Use --diff-context=N to control how much context you want to see.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("diff-context")
|
||||||
|
.long("diff-context")
|
||||||
|
.overrides_with("diff-context")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("N")
|
||||||
|
.validator(
|
||||||
|
|n| {
|
||||||
|
n.parse::<usize>()
|
||||||
|
.map_err(|_| "must be a number")
|
||||||
|
.map(|_| ()) // Convert to Result<(), &str>
|
||||||
|
.map_err(|e| e.to_string())
|
||||||
|
}, // Convert to Result<(), String>
|
||||||
|
)
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.long_help(
|
||||||
|
"Include N lines of context around added/removed/modified lines when using '--diff'.",
|
||||||
|
),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("tabs")
|
Arg::with_name("tabs")
|
||||||
.long("tabs")
|
.long("tabs")
|
||||||
@@ -152,7 +181,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
t.parse::<i32>()
|
t.parse::<i32>()
|
||||||
.map_err(|_e| "must be an offset or number")
|
.map_err(|_e| "must be an offset or number")
|
||||||
.and_then(|v| if v == 0 && !is_offset {
|
.and_then(|v| if v == 0 && !is_offset {
|
||||||
Err("terminal width cannot be zero".into())
|
Err("terminal width cannot be zero")
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
})
|
})
|
||||||
@@ -339,6 +368,7 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
|||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.number_of_values(1)
|
.number_of_values(1)
|
||||||
.value_name("N:M")
|
.value_name("N:M")
|
||||||
|
.conflicts_with("diff")
|
||||||
.help("Only print the lines from N to M.")
|
.help("Only print the lines from N to M.")
|
||||||
.long_help(
|
.long_help(
|
||||||
"Only print the specified range of lines for each file. \
|
"Only print the specified range of lines for each file. \
|
||||||
|
|||||||
@@ -35,10 +35,11 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
|||||||
match config_dir {
|
match config_dir {
|
||||||
Some(path) => fs::create_dir_all(path)?,
|
Some(path) => fs::create_dir_all(path)?,
|
||||||
None => {
|
None => {
|
||||||
return Ok(Err(format!(
|
return Err(format!(
|
||||||
"Unable to write config file to: {}",
|
"Unable to write config file to: {}",
|
||||||
config_file.to_string_lossy()
|
config_file.to_string_lossy()
|
||||||
))?)
|
)
|
||||||
|
.into());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -77,7 +78,7 @@ pub fn generate_config_file() -> bat::error::Result<()> {
|
|||||||
config_file.to_string_lossy()
|
config_file.to_string_lossy()
|
||||||
);
|
);
|
||||||
|
|
||||||
return Ok(());
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {
|
pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {
|
||||||
|
|||||||
+3
-2
@@ -70,7 +70,7 @@ pub fn list_languages(config: &Config) -> Result<()> {
|
|||||||
|
|
||||||
if config.loop_through {
|
if config.loop_through {
|
||||||
for lang in languages {
|
for lang in languages {
|
||||||
write!(stdout, "{}:{}\n", lang.name, lang.file_extensions.join(","))?;
|
writeln!(stdout, "{}:{}", lang.name, lang.file_extensions.join(","))?;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
let longest = languages
|
let longest = languages
|
||||||
@@ -210,7 +210,8 @@ fn main() {
|
|||||||
|
|
||||||
match result {
|
match result {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
default_error_handler(&error);
|
let stderr = std::io::stderr();
|
||||||
|
default_error_handler(&error, &mut stderr.lock());
|
||||||
process::exit(1);
|
process::exit(1);
|
||||||
}
|
}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
|
|||||||
+29
-6
@@ -5,6 +5,32 @@ use crate::style::StyleComponents;
|
|||||||
use crate::syntax_mapping::SyntaxMapping;
|
use crate::syntax_mapping::SyntaxMapping;
|
||||||
use crate::wrapping::WrappingMode;
|
use crate::wrapping::WrappingMode;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub enum VisibleLines {
|
||||||
|
/// Show all lines which are included in the line ranges
|
||||||
|
Ranges(LineRanges),
|
||||||
|
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
/// Only show lines surrounding added/deleted/modified lines
|
||||||
|
DiffContext(usize),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl VisibleLines {
|
||||||
|
pub fn diff_mode(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
Self::Ranges(_) => false,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
Self::DiffContext(_) => true,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Default for VisibleLines {
|
||||||
|
fn default() -> Self {
|
||||||
|
VisibleLines::Ranges(LineRanges::default())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
pub struct Config<'a> {
|
pub struct Config<'a> {
|
||||||
/// The explicitly configured language, if any
|
/// The explicitly configured language, if any
|
||||||
@@ -39,8 +65,8 @@ pub struct Config<'a> {
|
|||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
pub paging_mode: PagingMode,
|
pub paging_mode: PagingMode,
|
||||||
|
|
||||||
/// Specifies the lines that should be printed
|
/// Specifies which lines should be printed
|
||||||
pub line_ranges: LineRanges,
|
pub visible_lines: VisibleLines,
|
||||||
|
|
||||||
/// The syntax highlighting theme
|
/// The syntax highlighting theme
|
||||||
pub theme: String,
|
pub theme: String,
|
||||||
@@ -62,10 +88,7 @@ pub struct Config<'a> {
|
|||||||
fn default_config_should_include_all_lines() {
|
fn default_config_should_include_all_lines() {
|
||||||
use crate::line_range::RangeCheckResult;
|
use crate::line_range::RangeCheckResult;
|
||||||
|
|
||||||
assert_eq!(
|
assert_eq!(LineRanges::default().check(17), RangeCheckResult::InRange);
|
||||||
Config::default().line_ranges.check(17),
|
|
||||||
RangeCheckResult::InRange
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|||||||
+78
-8
@@ -1,9 +1,13 @@
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
use crate::assets::HighlightingAssets;
|
use crate::assets::HighlightingAssets;
|
||||||
use crate::config::Config;
|
use crate::config::{Config, VisibleLines};
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
use crate::diff::{get_git_diff, LineChanges};
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
use crate::input::{Input, InputReader, OpenedInput};
|
use crate::input::{Input, InputReader, OpenedInput};
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
use crate::line_range::LineRange;
|
||||||
use crate::line_range::{LineRanges, RangeCheckResult};
|
use crate::line_range::{LineRanges, RangeCheckResult};
|
||||||
use crate::output::OutputType;
|
use crate::output::OutputType;
|
||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
@@ -27,7 +31,7 @@ impl<'b> Controller<'b> {
|
|||||||
pub fn run_with_error_handler(
|
pub fn run_with_error_handler(
|
||||||
&self,
|
&self,
|
||||||
inputs: Vec<Input>,
|
inputs: Vec<Input>,
|
||||||
handle_error: impl Fn(&Error),
|
handle_error: impl Fn(&Error, &mut dyn Write),
|
||||||
) -> Result<bool> {
|
) -> Result<bool> {
|
||||||
let mut output_type;
|
let mut output_type;
|
||||||
|
|
||||||
@@ -41,9 +45,9 @@ impl<'b> Controller<'b> {
|
|||||||
if self.config.paging_mode != PagingMode::Never {
|
if self.config.paging_mode != PagingMode::Never {
|
||||||
let call_pager = inputs.iter().any(|ref input| {
|
let call_pager = inputs.iter().any(|ref input| {
|
||||||
if let InputKind::OrdinaryFile(ref path) = input.kind {
|
if let InputKind::OrdinaryFile(ref path) = input.kind {
|
||||||
return Path::new(path).exists();
|
Path::new(path).exists()
|
||||||
} else {
|
} else {
|
||||||
return true;
|
true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if !call_pager {
|
if !call_pager {
|
||||||
@@ -58,16 +62,56 @@ impl<'b> Controller<'b> {
|
|||||||
output_type = OutputType::stdout();
|
output_type = OutputType::stdout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let attached_to_pager = output_type.is_pager();
|
||||||
let writer = output_type.handle()?;
|
let writer = output_type.handle()?;
|
||||||
let mut no_errors: bool = true;
|
let mut no_errors: bool = true;
|
||||||
|
|
||||||
|
let stderr = io::stderr();
|
||||||
|
let print_error = |error: &Error, write: &mut dyn Write| {
|
||||||
|
if attached_to_pager {
|
||||||
|
handle_error(error, write);
|
||||||
|
} else {
|
||||||
|
handle_error(error, &mut stderr.lock());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
for input in inputs.into_iter() {
|
for input in inputs.into_iter() {
|
||||||
match input.open(io::stdin().lock()) {
|
match input.open(io::stdin().lock()) {
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
handle_error(&error);
|
print_error(&error, writer);
|
||||||
no_errors = false;
|
no_errors = false;
|
||||||
}
|
}
|
||||||
Ok(mut opened_input) => {
|
Ok(mut opened_input) => {
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
let line_changes = if self.config.visible_lines.diff_mode()
|
||||||
|
|| (!self.config.loop_through && self.config.style_components.changes())
|
||||||
|
{
|
||||||
|
match opened_input.kind {
|
||||||
|
crate::input::OpenedInputKind::OrdinaryFile(ref path) => {
|
||||||
|
let diff = get_git_diff(path);
|
||||||
|
|
||||||
|
// Skip files without Git modifications
|
||||||
|
if self.config.visible_lines.diff_mode()
|
||||||
|
&& diff
|
||||||
|
.as_ref()
|
||||||
|
.map(|changes| changes.is_empty())
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff
|
||||||
|
}
|
||||||
|
_ if self.config.visible_lines.diff_mode() => {
|
||||||
|
// Skip non-file inputs in diff mode
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
let mut printer: Box<dyn Printer> = if self.config.loop_through {
|
let mut printer: Box<dyn Printer> = if self.config.loop_through {
|
||||||
Box::new(SimplePrinter::new())
|
Box::new(SimplePrinter::new())
|
||||||
} else {
|
} else {
|
||||||
@@ -75,13 +119,21 @@ impl<'b> Controller<'b> {
|
|||||||
&self.config,
|
&self.config,
|
||||||
&self.assets,
|
&self.assets,
|
||||||
&mut opened_input,
|
&mut opened_input,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
&line_changes,
|
||||||
))
|
))
|
||||||
};
|
};
|
||||||
|
|
||||||
let result = self.print_file(&mut *printer, writer, &mut opened_input);
|
let result = self.print_file(
|
||||||
|
&mut *printer,
|
||||||
|
writer,
|
||||||
|
&mut opened_input,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
&line_changes,
|
||||||
|
);
|
||||||
|
|
||||||
if let Err(error) = result {
|
if let Err(error) = result {
|
||||||
handle_error(&error);
|
print_error(&error, writer);
|
||||||
no_errors = false;
|
no_errors = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -96,13 +148,31 @@ impl<'b> Controller<'b> {
|
|||||||
printer: &mut dyn Printer,
|
printer: &mut dyn Printer,
|
||||||
writer: &mut dyn Write,
|
writer: &mut dyn Write,
|
||||||
input: &mut OpenedInput,
|
input: &mut OpenedInput,
|
||||||
|
#[cfg(feature = "git")] line_changes: &Option<LineChanges>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
if !input.reader.first_line.is_empty() || self.config.style_components.header() {
|
if !input.reader.first_line.is_empty() || self.config.style_components.header() {
|
||||||
printer.print_header(writer, input)?;
|
printer.print_header(writer, input)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !input.reader.first_line.is_empty() {
|
if !input.reader.first_line.is_empty() {
|
||||||
self.print_file_ranges(printer, writer, &mut input.reader, &self.config.line_ranges)?;
|
let line_ranges = match self.config.visible_lines {
|
||||||
|
VisibleLines::Ranges(ref line_ranges) => line_ranges.clone(),
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
VisibleLines::DiffContext(context) => {
|
||||||
|
let mut line_ranges: Vec<LineRange> = vec![];
|
||||||
|
|
||||||
|
if let Some(line_changes) = line_changes {
|
||||||
|
for line in line_changes.keys() {
|
||||||
|
let line = *line as usize;
|
||||||
|
line_ranges.push(LineRange::new(line - context, line + context));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LineRanges::from(line_ranges)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.print_file_ranges(printer, writer, &mut input.reader, &line_ranges)?;
|
||||||
}
|
}
|
||||||
printer.print_footer(writer, input)?;
|
printer.print_footer(writer, input)?;
|
||||||
|
|
||||||
|
|||||||
+7
-4
@@ -1,4 +1,5 @@
|
|||||||
use error_chain::error_chain;
|
use error_chain::error_chain;
|
||||||
|
use std::io::Write;
|
||||||
|
|
||||||
error_chain! {
|
error_chain! {
|
||||||
foreign_links {
|
foreign_links {
|
||||||
@@ -11,7 +12,7 @@ error_chain! {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn default_error_handler(error: &Error) {
|
pub fn default_error_handler(error: &Error, output: &mut dyn Write) {
|
||||||
use ansi_term::Colour::Red;
|
use ansi_term::Colour::Red;
|
||||||
|
|
||||||
match error {
|
match error {
|
||||||
@@ -21,14 +22,16 @@ pub fn default_error_handler(error: &Error) {
|
|||||||
::std::process::exit(0);
|
::std::process::exit(0);
|
||||||
}
|
}
|
||||||
Error(ErrorKind::SerdeYamlError(_), _) => {
|
Error(ErrorKind::SerdeYamlError(_), _) => {
|
||||||
eprintln!(
|
writeln!(
|
||||||
|
output,
|
||||||
"{}: Error while parsing metadata.yaml file: {}",
|
"{}: Error while parsing metadata.yaml file: {}",
|
||||||
Red.paint("[bat error]"),
|
Red.paint("[bat error]"),
|
||||||
error
|
error
|
||||||
);
|
)
|
||||||
|
.ok();
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
eprintln!("{}: {}", Red.paint("[bat error]"), error);
|
writeln!(output, "{}: {}", Red.paint("[bat error]"), error).ok();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -30,7 +30,7 @@ impl LineRange {
|
|||||||
fn parse_range(range_raw: &str) -> Result<LineRange> {
|
fn parse_range(range_raw: &str) -> Result<LineRange> {
|
||||||
let mut new_range = LineRange::default();
|
let mut new_range = LineRange::default();
|
||||||
|
|
||||||
if range_raw.bytes().nth(0).ok_or("Empty line range")? == b':' {
|
if range_raw.bytes().next().ok_or("Empty line range")? == b':' {
|
||||||
new_range.upper = range_raw[1..].parse()?;
|
new_range.upper = range_raw[1..].parse()?;
|
||||||
return Ok(new_range);
|
return Ok(new_range);
|
||||||
} else if range_raw.bytes().last().ok_or("Empty line range")? == b':' {
|
} else if range_raw.bytes().last().ok_or("Empty line range")? == b':' {
|
||||||
|
|||||||
@@ -125,6 +125,20 @@ impl OutputType {
|
|||||||
OutputType::Stdout(io::stdout())
|
OutputType::Stdout(io::stdout())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "paging")]
|
||||||
|
pub(crate) fn is_pager(&self) -> bool {
|
||||||
|
if let OutputType::Pager(_) = self {
|
||||||
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "paging"))]
|
||||||
|
pub(crate) fn is_pager(&self) -> bool {
|
||||||
|
false
|
||||||
|
}
|
||||||
|
|
||||||
pub fn handle(&mut self) -> Result<&mut dyn Write> {
|
pub fn handle(&mut self) -> Result<&mut dyn Write> {
|
||||||
Ok(match *self {
|
Ok(match *self {
|
||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
|
|||||||
+8
-8
@@ -36,15 +36,15 @@ pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String {
|
|||||||
fn try_parse_utf8_char(input: &[u8]) -> Option<(char, usize)> {
|
fn try_parse_utf8_char(input: &[u8]) -> Option<(char, usize)> {
|
||||||
let str_from_utf8 = |seq| std::str::from_utf8(seq).ok();
|
let str_from_utf8 = |seq| std::str::from_utf8(seq).ok();
|
||||||
|
|
||||||
let decoded = None
|
let decoded = input
|
||||||
.or(input.get(0..1).and_then(str_from_utf8).map(|c| (c, 1)))
|
.get(0..1)
|
||||||
.or(input.get(0..2).and_then(str_from_utf8).map(|c| (c, 2)))
|
.and_then(str_from_utf8)
|
||||||
.or(input.get(0..3).and_then(str_from_utf8).map(|c| (c, 3)))
|
.map(|c| (c, 1))
|
||||||
.or(input.get(0..4).and_then(str_from_utf8).map(|c| (c, 4)));
|
.or_else(|| input.get(0..2).and_then(str_from_utf8).map(|c| (c, 2)))
|
||||||
|
.or_else(|| input.get(0..3).and_then(str_from_utf8).map(|c| (c, 3)))
|
||||||
|
.or_else(|| input.get(0..4).and_then(str_from_utf8).map(|c| (c, 4)));
|
||||||
|
|
||||||
let decoded_char = decoded.map(|(seq, n)| (seq.chars().next().unwrap(), n));
|
decoded.map(|(seq, n)| (seq.chars().next().unwrap(), n))
|
||||||
|
|
||||||
decoded_char
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
|
pub fn replace_nonprintable(input: &[u8], tab_width: usize) -> String {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use syntect::parsing::SyntaxReference;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
assets::HighlightingAssets,
|
assets::HighlightingAssets,
|
||||||
config::Config,
|
config::{Config, VisibleLines},
|
||||||
controller::Controller,
|
controller::Controller,
|
||||||
error::Result,
|
error::Result,
|
||||||
input::Input,
|
input::Input,
|
||||||
@@ -205,7 +205,7 @@ impl<'a> PrettyPrinter<'a> {
|
|||||||
|
|
||||||
/// Specify the lines that should be printed (default: all)
|
/// Specify the lines that should be printed (default: all)
|
||||||
pub fn line_ranges(&mut self, ranges: LineRanges) -> &mut Self {
|
pub fn line_ranges(&mut self, ranges: LineRanges) -> &mut Self {
|
||||||
self.config.line_ranges = ranges;
|
self.config.visible_lines = VisibleLines::Ranges(ranges);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+9
-24
@@ -24,7 +24,7 @@ use crate::config::Config;
|
|||||||
use crate::decorations::LineChangesDecoration;
|
use crate::decorations::LineChangesDecoration;
|
||||||
use crate::decorations::{Decoration, GridBorderDecoration, LineNumberDecoration};
|
use crate::decorations::{Decoration, GridBorderDecoration, LineNumberDecoration};
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
use crate::diff::{get_git_diff, LineChanges};
|
use crate::diff::LineChanges;
|
||||||
use crate::error::*;
|
use crate::error::*;
|
||||||
use crate::input::OpenedInput;
|
use crate::input::OpenedInput;
|
||||||
use crate::line_range::RangeCheckResult;
|
use crate::line_range::RangeCheckResult;
|
||||||
@@ -90,7 +90,7 @@ pub(crate) struct InteractivePrinter<'a> {
|
|||||||
ansi_prefix_sgr: String,
|
ansi_prefix_sgr: String,
|
||||||
content_type: Option<ContentType>,
|
content_type: Option<ContentType>,
|
||||||
#[cfg(feature = "git")]
|
#[cfg(feature = "git")]
|
||||||
pub line_changes: Option<LineChanges>,
|
pub line_changes: &'a Option<LineChanges>,
|
||||||
highlighter: Option<HighlightLines<'a>>,
|
highlighter: Option<HighlightLines<'a>>,
|
||||||
syntax_set: &'a SyntaxSet,
|
syntax_set: &'a SyntaxSet,
|
||||||
background_color_highlight: Option<Color>,
|
background_color_highlight: Option<Color>,
|
||||||
@@ -101,6 +101,8 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
config: &'a Config,
|
config: &'a Config,
|
||||||
assets: &'a HighlightingAssets,
|
assets: &'a HighlightingAssets,
|
||||||
input: &mut OpenedInput,
|
input: &mut OpenedInput,
|
||||||
|
#[cfg(feature = "git")]
|
||||||
|
line_changes: &'a Option<LineChanges>,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let theme = assets.get_theme(&config.theme);
|
let theme = assets.get_theme(&config.theme);
|
||||||
|
|
||||||
@@ -145,9 +147,6 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
panel_width = 0;
|
panel_width = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "git")]
|
|
||||||
let mut line_changes = None;
|
|
||||||
|
|
||||||
let highlighter = if input
|
let highlighter = if input
|
||||||
.reader
|
.reader
|
||||||
.content_type
|
.content_type
|
||||||
@@ -155,18 +154,6 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
{
|
{
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
// Get the Git modifications
|
|
||||||
#[cfg(feature = "git")]
|
|
||||||
{
|
|
||||||
use crate::input::OpenedInputKind;
|
|
||||||
|
|
||||||
if config.style_components.changes() {
|
|
||||||
if let OpenedInputKind::OrdinaryFile(ref path) = input.kind {
|
|
||||||
line_changes = get_git_diff(path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Determine the type of syntax for highlighting
|
// Determine the type of syntax for highlighting
|
||||||
let syntax = assets.get_syntax(config.language, input, &config.syntax_mapping);
|
let syntax = assets.get_syntax(config.language, input, &config.syntax_mapping);
|
||||||
Some(HighlightLines::new(syntax, theme))
|
Some(HighlightLines::new(syntax, theme))
|
||||||
@@ -216,7 +203,7 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
if self.config.style_components.grid() {
|
if self.config.style_components.grid() {
|
||||||
format!("{} │ ", text_filled)
|
format!("{} │ ", text_filled)
|
||||||
} else {
|
} else {
|
||||||
format!("{}", text_filled)
|
text_filled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -243,10 +230,8 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
Yellow.paint("[bat warning]"),
|
Yellow.paint("[bat warning]"),
|
||||||
input.description().full,
|
input.description().full,
|
||||||
)?;
|
)?;
|
||||||
} else {
|
} else if self.config.style_components.grid() {
|
||||||
if self.config.style_components.grid() {
|
self.print_horizontal_line(handle, '┬')?;
|
||||||
self.print_horizontal_line(handle, '┬')?;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
@@ -318,9 +303,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
let snip_right =
|
let snip_right =
|
||||||
" ─".repeat((self.config.term_width - panel_count - snip_left_count - title_count) / 2);
|
" ─".repeat((self.config.term_width - panel_count - snip_left_count - title_count) / 2);
|
||||||
|
|
||||||
write!(
|
writeln!(
|
||||||
handle,
|
handle,
|
||||||
"{}\n",
|
"{}",
|
||||||
self.colors
|
self.colors
|
||||||
.grid
|
.grid
|
||||||
.paint(format!("{}{}{}{}", panel, snip_left, title, snip_right))
|
.paint(format!("{}{}{}{}", panel, snip_left, title, snip_right))
|
||||||
|
|||||||
@@ -30,7 +30,10 @@ impl<'a> SyntaxMapping<'a> {
|
|||||||
.insert("**/.ssh/config", MappingTarget::MapTo("SSH Config"))
|
.insert("**/.ssh/config", MappingTarget::MapTo("SSH Config"))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
mapping
|
mapping
|
||||||
.insert("**/bat/config", MappingTarget::MapTo("Bourne Again Shell (bash)"))
|
.insert(
|
||||||
|
"**/bat/config",
|
||||||
|
MappingTarget::MapTo("Bourne Again Shell (bash)"),
|
||||||
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
mapping
|
mapping
|
||||||
.insert(
|
.insert(
|
||||||
|
|||||||
+14
-14
@@ -7,11 +7,13 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term:
|
|||||||
if color.a == 0 {
|
if color.a == 0 {
|
||||||
// Themes can specify one of the user-configurable terminal colors by
|
// Themes can specify one of the user-configurable terminal colors by
|
||||||
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
|
// encoding them as #RRGGBBAA with AA set to 00 (transparent) and RR set
|
||||||
// to the color palette number. The built-in themes ansi-light,
|
// to the 8-bit color palette number. The built-in themes ansi-light,
|
||||||
// ansi-dark, and base16 use this.
|
// ansi-dark, and base16 use this.
|
||||||
Fixed(color.r)
|
|
||||||
} else if color.a == 0x0f {
|
|
||||||
match color.r {
|
match color.r {
|
||||||
|
// For the first 8 colors, use the Color enum to produce ANSI escape
|
||||||
|
// sequences using codes 30-37 (foreground) and 40-47 (background).
|
||||||
|
// For example, red foreground is \x1b[31m. This works on terminals
|
||||||
|
// without 256-color support.
|
||||||
0x00 => Color::Black,
|
0x00 => Color::Black,
|
||||||
0x01 => Color::Red,
|
0x01 => Color::Red,
|
||||||
0x02 => Color::Green,
|
0x02 => Color::Green,
|
||||||
@@ -20,17 +22,15 @@ pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term:
|
|||||||
0x05 => Color::Purple,
|
0x05 => Color::Purple,
|
||||||
0x06 => Color::Cyan,
|
0x06 => Color::Cyan,
|
||||||
0x07 => Color::White,
|
0x07 => Color::White,
|
||||||
// TODO: the following should be high-intensity variants of
|
// For all other colors, use Fixed to produce escape sequences using
|
||||||
// these colors ("bright black", "bright red", ...).
|
// codes 38;5 (foreground) and 48;5 (background). For example,
|
||||||
0x08 => Color::Black,
|
// bright red foreground is \x1b[38;5;9m. This only works on
|
||||||
0x09 => Color::Red,
|
// terminals with 256-color support.
|
||||||
0x0a => Color::Green,
|
//
|
||||||
0x0b => Color::Yellow,
|
// TODO: When ansi_term adds support for bright variants using codes
|
||||||
0x0c => Color::Blue,
|
// 90-97 (foreground) and 100-107 (background), we should use those
|
||||||
0x0d => Color::Purple,
|
// for values 0x08 to 0x0f and only use Fixed for 0x10 to 0xff.
|
||||||
0x0e => Color::Cyan,
|
n => Fixed(n),
|
||||||
0x0f => Color::White,
|
|
||||||
_ => unreachable!("The 0x0f color encoding does not allow for codes higher than 0x0f")
|
|
||||||
}
|
}
|
||||||
} else if true_color {
|
} else if true_color {
|
||||||
RGB(color.r, color.g, color.b)
|
RGB(color.r, color.g, color.b)
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ use bat::assets::HighlightingAssets;
|
|||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_duplicate_extensions() {
|
fn no_duplicate_extensions() {
|
||||||
const KNOWN_EXCEPTIONS: &[&'static str] = &[
|
const KNOWN_EXCEPTIONS: &[&str] = &[
|
||||||
// The '.h' extension currently appears in multiple syntaxes: C, C++, Objective C,
|
// The '.h' extension currently appears in multiple syntaxes: C, C++, Objective C,
|
||||||
// Objective C++
|
// Objective C++
|
||||||
"h",
|
"h",
|
||||||
|
|||||||
Reference in New Issue
Block a user