mirror of
https://github.com/sharkdp/bat.git
synced 2024-11-24 08:43:25 +01:00
Merge branch 'master' into dark-light
This commit is contained in:
commit
60693db73f
@ -10,6 +10,7 @@
|
|||||||
- `bat --strip-ansi={never,always,auto}` to remove ANSI escape sequences from bat's input, see #2999 (@eth-p)
|
- `bat --strip-ansi={never,always,auto}` to remove ANSI escape sequences from bat's input, see #2999 (@eth-p)
|
||||||
- Add or remove individual style components without replacing all styles #2929 (@eth-p)
|
- Add or remove individual style components without replacing all styles #2929 (@eth-p)
|
||||||
- Automatically choose theme based on the terminal's color scheme, see #2896 (@bash)
|
- Automatically choose theme based on the terminal's color scheme, see #2896 (@bash)
|
||||||
|
- Add option `--binary=as-text` for printing binary content, see issue #2974 and PR #2976 (@einfachIrgendwer0815)
|
||||||
|
|
||||||
## Bugfixes
|
## Bugfixes
|
||||||
|
|
||||||
@ -19,6 +20,7 @@
|
|||||||
- Fix handling of inputs with combined ANSI color and attribute sequences, see #2185 and #2856 (@eth-p)
|
- Fix handling of inputs with combined ANSI color and attribute sequences, see #2185 and #2856 (@eth-p)
|
||||||
- Fix panel width when line 10000 wraps, see #2854 (@eth-p)
|
- Fix panel width when line 10000 wraps, see #2854 (@eth-p)
|
||||||
- Fix compile issue of `time` dependency caused by standard library regression #3045 (@cyqsimon)
|
- Fix compile issue of `time` dependency caused by standard library regression #3045 (@cyqsimon)
|
||||||
|
- Fix override behavior of --plain and --paging, see issue #2731 and PR #3108 (@einfachIrgendwer0815)
|
||||||
|
|
||||||
## Other
|
## Other
|
||||||
|
|
||||||
@ -45,6 +47,7 @@
|
|||||||
- Use bat's ANSI iterator during tab expansion, see #2998 (@eth-p)
|
- Use bat's ANSI iterator during tab expansion, see #2998 (@eth-p)
|
||||||
- Support 'statically linked binary' for aarch64 in 'Release' page, see #2992 (@tzq0301)
|
- Support 'statically linked binary' for aarch64 in 'Release' page, see #2992 (@tzq0301)
|
||||||
- Update options in shell completions and the man page of `bat`, see #2995 (@akinomyoga)
|
- Update options in shell completions and the man page of `bat`, see #2995 (@akinomyoga)
|
||||||
|
- Update nix dev-dependency to v0.29.0, see #3112 (@decathorpe)
|
||||||
|
|
||||||
## Syntaxes
|
## Syntaxes
|
||||||
|
|
||||||
@ -56,9 +59,14 @@
|
|||||||
- Associate JSON with Comments `.jsonc` with `json` syntax, see #2795 (@mxaddict)
|
- Associate JSON with Comments `.jsonc` with `json` syntax, see #2795 (@mxaddict)
|
||||||
- Associate JSON-LD `.jsonld` files with `json` syntax, see #3037 (@vorburger)
|
- Associate JSON-LD `.jsonld` files with `json` syntax, see #3037 (@vorburger)
|
||||||
- Associate `.textproto` files with `ProtoBuf` syntax, see #3038 (@vorburger)
|
- Associate `.textproto` files with `ProtoBuf` syntax, see #3038 (@vorburger)
|
||||||
|
- Associate GeoJSON `.geojson` files with `json` syntax, see #3084 (@mvaaltola)
|
||||||
- Associate `.aws/{config,credentials}`, see #2795 (@mxaddict)
|
- Associate `.aws/{config,credentials}`, see #2795 (@mxaddict)
|
||||||
- Associate Wireguard config `/etc/wireguard/*.conf`, see #2874 (@cyqsimon)
|
- Associate Wireguard config `/etc/wireguard/*.conf`, see #2874 (@cyqsimon)
|
||||||
- Add support for [CFML](https://www.adobe.com/products/coldfusion-family.html), see #3031 (@brenton-at-pieces)
|
- Add support for [CFML](https://www.adobe.com/products/coldfusion-family.html), see #3031 (@brenton-at-pieces)
|
||||||
|
- Map `*.mkd` files to `Markdown` syntax, see issue #3060 and PR #3061 (@einfachIrgendwer0815)
|
||||||
|
- Add syntax mapping for kubernetes config files #3049 (@cyqsimon)
|
||||||
|
- Adds support for pipe delimiter for CSV #3115 (@pratik-m)
|
||||||
|
- Add syntax mapping for `/etc/pacman.conf` #2961 (@cyqsimon)
|
||||||
|
|
||||||
## Themes
|
## Themes
|
||||||
|
|
||||||
@ -111,6 +119,7 @@
|
|||||||
- Update `Julia` syntax, see #2553 (@dependabot)
|
- Update `Julia` syntax, see #2553 (@dependabot)
|
||||||
- add `NSIS` support, see #2577 (@idleberg)
|
- add `NSIS` support, see #2577 (@idleberg)
|
||||||
- Update `ssh-config`, see #2697 (@mrmeszaros)
|
- Update `ssh-config`, see #2697 (@mrmeszaros)
|
||||||
|
- Add syntax mapping `*.debdiff` => `diff`, see #2947 (@jacg)
|
||||||
|
|
||||||
## `bat` as a library
|
## `bat` as a library
|
||||||
|
|
||||||
|
127
Cargo.lock
generated
127
Cargo.lock
generated
@ -3,10 +3,10 @@
|
|||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "adler"
|
name = "adler2"
|
||||||
version = "1.0.2"
|
version = "2.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aho-corasick"
|
name = "aho-corasick"
|
||||||
@ -103,9 +103,9 @@ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.21.0"
|
version = "0.22.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a"
|
checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bat"
|
name = "bat"
|
||||||
@ -244,6 +244,12 @@ version = "1.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg_aliases"
|
||||||
|
version = "0.2.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "4.4.12"
|
version = "4.4.12"
|
||||||
@ -274,12 +280,11 @@ checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clircle"
|
name = "clircle"
|
||||||
version = "0.5.0"
|
version = "0.6.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ec0b92245ea62a7a751db4b0e4a583f8978e508077ef6de24fcc0d0dc5311a8d"
|
checksum = "e136d50bd652710f1d86259a8977263d46bef0ab782a8bfc3887e44338517015"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"libc",
|
|
||||||
"serde",
|
"serde",
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
"winapi",
|
"winapi",
|
||||||
@ -417,9 +422,9 @@ checksum = "a357d28ed41a50f9c765dbfe56cbc04a64e53e5fc58ba79fbc34c10ef3df831f"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "encoding_rs"
|
name = "encoding_rs"
|
||||||
version = "0.8.34"
|
version = "0.8.35"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b45de904aa0b010bce2ab45264d0631681847fa7b6f2eaa7dab7619943bc4f59"
|
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
]
|
]
|
||||||
@ -490,9 +495,9 @@ checksum = "6999dc1837253364c2ebb0704ba97994bd874e8f195d665c50b7548f6ea92764"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.30"
|
version = "1.0.34"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae"
|
checksum = "a1b589b4dc103969ad3cf85c950899926ec64300a1a46d76c03a6072957036f0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
@ -565,9 +570,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "git2"
|
name = "git2"
|
||||||
version = "0.18.3"
|
version = "0.19.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70"
|
checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 2.4.0",
|
"bitflags 2.4.0",
|
||||||
"libc",
|
"libc",
|
||||||
@ -584,9 +589,9 @@ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "globset"
|
name = "globset"
|
||||||
version = "0.4.14"
|
version = "0.4.15"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "57da3b9b5b85bd66f31093f8c408b90a74431672542466497dcbdfdc02034be1"
|
checksum = "15f1ce686646e7f1e19bf7d5533fe443a45dbfb990e00629110797578b42fb19"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick",
|
"aho-corasick",
|
||||||
"bstr",
|
"bstr",
|
||||||
@ -597,9 +602,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "grep-cli"
|
name = "grep-cli"
|
||||||
version = "0.1.10"
|
version = "0.1.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ea40788c059ab8b622c4d074732750bfb3bd2912e2dd58eabc11798a4d5ad725"
|
checksum = "47f1288f0e06f279f84926fa4c17e3fcd2a22b357927a82f2777f7be26e4cec0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bstr",
|
"bstr",
|
||||||
"globset",
|
"globset",
|
||||||
@ -695,15 +700,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.155"
|
version = "0.2.161"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
name = "libgit2-sys"
|
||||||
version = "0.16.2+1.7.2"
|
version = "0.17.0+1.8.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8"
|
checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc",
|
"cc",
|
||||||
"libc",
|
"libc",
|
||||||
@ -723,15 +728,6 @@ dependencies = [
|
|||||||
"vcpkg",
|
"vcpkg",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "line-wrap"
|
|
||||||
version = "0.1.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f30344350a2a51da54c1d53be93fade8a237e545dbcc4bdbe635413f2117cab9"
|
|
||||||
dependencies = [
|
|
||||||
"safemem",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "linked-hash-map"
|
name = "linked-hash-map"
|
||||||
version = "0.5.6"
|
version = "0.5.6"
|
||||||
@ -768,11 +764,11 @@ checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.7.1"
|
version = "0.8.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7"
|
checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler",
|
"adler2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -789,12 +785,13 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "nix"
|
name = "nix"
|
||||||
version = "0.26.4"
|
version = "0.29.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b"
|
checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.3.2",
|
"bitflags 2.4.0",
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
|
"cfg_aliases",
|
||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -830,9 +827,12 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.19.0"
|
version = "1.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92"
|
checksum = "82881c4be219ab5faaf2ad5e5e5ecdff8c66bd7402ca3160975c93b24961afd1"
|
||||||
|
dependencies = [
|
||||||
|
"portable-atomic",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "onig"
|
name = "onig"
|
||||||
@ -911,18 +911,23 @@ checksum = "1df8c4ec4b0627e53bdf214615ad287367e482558cf84b109250b37464dc03ae"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plist"
|
name = "plist"
|
||||||
version = "1.6.0"
|
version = "1.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e5699cc8a63d1aa2b1ee8e12b9ad70ac790d65788cd36101fa37f87ea46c4cef"
|
checksum = "42cf17e9a1800f5f396bc67d193dc9411b59012a5876445ef450d449881e1016"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64",
|
"base64",
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"line-wrap",
|
|
||||||
"quick-xml",
|
"quick-xml",
|
||||||
"serde",
|
"serde",
|
||||||
"time",
|
"time",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "portable-atomic"
|
||||||
|
version = "1.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "cc9c68a3f6da06753e9335d63e27f6b9754dd1920d941135b7ea8224f141adb2"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "powerfmt"
|
name = "powerfmt"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@ -976,9 +981,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quick-xml"
|
name = "quick-xml"
|
||||||
version = "0.31.0"
|
version = "0.32.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "1004a344b30a54e2ee58d66a71b32d2db2feb0a31f9a2d302bf0536f15de2a33"
|
checksum = "1d3a6e5838b60e0e8fa7a43f22ade549a37d61f8bdbe636d0d7816191de969c2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
@ -1106,12 +1111,6 @@ version = "1.0.11"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "safemem"
|
|
||||||
version = "0.3.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ef703b7cb59335eae2eb93ceb664c0eb7ea6bf567079d843e09420219668e072"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "same-file"
|
name = "same-file"
|
||||||
version = "1.0.6"
|
version = "1.0.6"
|
||||||
@ -1135,18 +1134,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.199"
|
version = "1.0.209"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
|
checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.199"
|
version = "1.0.209"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
|
checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@ -1166,9 +1165,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.5"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
|
checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -1436,9 +1435,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.9"
|
version = "0.8.19"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6a4b9e8023eb94392d3dca65d717c53abc5dad49c07cb65bb8fcd87115fa325"
|
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1449,18 +1448,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.5"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.21.1"
|
version = "0.22.22"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1"
|
checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
@ -1790,9 +1789,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.5.18"
|
version = "0.6.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "176b6138793677221d420fd2f0aeeced263f197688b36484660da767bca2fa32"
|
checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
18
Cargo.toml
18
Cargo.toml
@ -46,7 +46,7 @@ ansi_colours = "^1.2"
|
|||||||
bincode = "1.0"
|
bincode = "1.0"
|
||||||
console = "0.15.8"
|
console = "0.15.8"
|
||||||
flate2 = "1.0"
|
flate2 = "1.0"
|
||||||
once_cell = "1.19"
|
once_cell = "1.20"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
wild = { version = "2.2", optional = true }
|
wild = { version = "2.2", optional = true }
|
||||||
content_inspector = "0.2.4"
|
content_inspector = "0.2.4"
|
||||||
@ -58,20 +58,20 @@ serde_derive = "1.0"
|
|||||||
serde_yaml = "0.9.28"
|
serde_yaml = "0.9.28"
|
||||||
semver = "1.0"
|
semver = "1.0"
|
||||||
path_abs = { version = "0.5", default-features = false }
|
path_abs = { version = "0.5", default-features = false }
|
||||||
clircle = "0.5"
|
clircle = "0.6"
|
||||||
bugreport = { version = "0.5.0", optional = true }
|
bugreport = { version = "0.5.0", optional = true }
|
||||||
etcetera = { version = "0.8.0", optional = true }
|
etcetera = { version = "0.8.0", optional = true }
|
||||||
grep-cli = { version = "0.1.10", optional = true }
|
grep-cli = { version = "0.1.11", optional = true }
|
||||||
regex = { version = "1.10.2", optional = true }
|
regex = { version = "1.10.2", optional = true }
|
||||||
walkdir = { version = "2.5", optional = true }
|
walkdir = { version = "2.5", optional = true }
|
||||||
bytesize = { version = "1.3.0" }
|
bytesize = { version = "1.3.0" }
|
||||||
encoding_rs = "0.8.34"
|
encoding_rs = "0.8.35"
|
||||||
os_str_bytes = { version = "~7.0", optional = true }
|
os_str_bytes = { version = "~7.0", optional = true }
|
||||||
run_script = { version = "^0.10.1", optional = true}
|
run_script = { version = "^0.10.1", optional = true}
|
||||||
terminal-colorsaurus = "0.4"
|
terminal-colorsaurus = "0.4"
|
||||||
|
|
||||||
[dependencies.git2]
|
[dependencies.git2]
|
||||||
version = "0.18"
|
version = "0.19"
|
||||||
optional = true
|
optional = true
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ features = ["wrap_help", "cargo"]
|
|||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
home = "0.5.9"
|
home = "0.5.9"
|
||||||
plist = "1.6.0"
|
plist = "1.7.0"
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
assert_cmd = "2.0.12"
|
assert_cmd = "2.0.12"
|
||||||
@ -99,18 +99,18 @@ tempfile = "3.8.1"
|
|||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
|
|
||||||
[target.'cfg(unix)'.dev-dependencies]
|
[target.'cfg(unix)'.dev-dependencies]
|
||||||
nix = { version = "0.26.4", default-features = false, features = ["term"] }
|
nix = { version = "0.29", default-features = false, features = ["term"] }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
anyhow = "1.0.86"
|
anyhow = "1.0.86"
|
||||||
indexmap = { version = "2.3.0", features = ["serde"] }
|
indexmap = { version = "2.3.0", features = ["serde"] }
|
||||||
itertools = "0.13.0"
|
itertools = "0.13.0"
|
||||||
once_cell = "1.18"
|
once_cell = "1.20"
|
||||||
regex = "1.10.2"
|
regex = "1.10.2"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
serde_derive = "1.0"
|
serde_derive = "1.0"
|
||||||
serde_with = { version = "3.8.1", default-features = false, features = ["macros"] }
|
serde_with = { version = "3.8.1", default-features = false, features = ["macros"] }
|
||||||
toml = { version = "0.8.9", features = ["preserve_order"] }
|
toml = { version = "0.8.19", features = ["preserve_order"] }
|
||||||
walkdir = "2.5"
|
walkdir = "2.5"
|
||||||
|
|
||||||
[build-dependencies.clap]
|
[build-dependencies.clap]
|
||||||
|
@ -35,11 +35,11 @@ A special *thank you* goes to our biggest <a href="doc/sponsors.md">sponsors</a>
|
|||||||
<a href="https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=bat_20231001">
|
<a href="https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=bat_20231001">
|
||||||
<img src="doc/sponsors/warp-logo.png" width="200" alt="Warp">
|
<img src="doc/sponsors/warp-logo.png" width="200" alt="Warp">
|
||||||
<br>
|
<br>
|
||||||
<strong>Warp is a modern, Rust-based terminal with AI built in<br>so you and your team can build great software, faster.</strong>
|
<strong>Warp, the intelligent terminal</strong>
|
||||||
<br>
|
<br>
|
||||||
<sub>Feel more productive on the command line with parameterized commands,</sub>
|
<sub>Run commands like a power user with AI and your dev team’s</sub>
|
||||||
<br>
|
<br>
|
||||||
<sup>autosuggestions, and an IDE-like text editor.</sup>
|
<sup>knowledge in one fast, intuitive terminal. For MacOS or Linux.</sup>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
### Syntax highlighting
|
### Syntax highlighting
|
||||||
|
19
assets/syntaxes/02_Extra/CSV.sublime-syntax
vendored
19
assets/syntaxes/02_Extra/CSV.sublime-syntax
vendored
@ -7,14 +7,14 @@ file_extensions:
|
|||||||
- tsv
|
- tsv
|
||||||
scope: text.csv
|
scope: text.csv
|
||||||
variables:
|
variables:
|
||||||
field_separator: (?:[,;\t])
|
field_separator: (?:[,;|\t])
|
||||||
record_separator: (?:$\n?)
|
record_separator: (?:$\n?)
|
||||||
contexts:
|
contexts:
|
||||||
prototype:
|
prototype:
|
||||||
- match: (?={{record_separator}})
|
- match: (?={{record_separator}})
|
||||||
pop: true
|
pop: true
|
||||||
fields:
|
fields:
|
||||||
- match: ''
|
- match: ""
|
||||||
push:
|
push:
|
||||||
- field_or_record_separator
|
- field_or_record_separator
|
||||||
- field4
|
- field4
|
||||||
@ -26,15 +26,15 @@ contexts:
|
|||||||
- field1
|
- field1
|
||||||
main:
|
main:
|
||||||
- meta_include_prototype: false
|
- meta_include_prototype: false
|
||||||
- match: '^'
|
- match: "^"
|
||||||
set: fields
|
set: fields
|
||||||
|
|
||||||
field_or_record_separator:
|
field_or_record_separator:
|
||||||
- meta_include_prototype: false
|
- meta_include_prototype: false
|
||||||
- match: '{{record_separator}}'
|
- match: "{{record_separator}}"
|
||||||
scope: punctuation.terminator.record.csv
|
scope: punctuation.terminator.record.csv
|
||||||
pop: true
|
pop: true
|
||||||
- match: '{{field_separator}}'
|
- match: "{{field_separator}}"
|
||||||
scope: punctuation.separator.sequence.csv
|
scope: punctuation.separator.sequence.csv
|
||||||
pop: true
|
pop: true
|
||||||
|
|
||||||
@ -56,23 +56,22 @@ contexts:
|
|||||||
pop: true
|
pop: true
|
||||||
|
|
||||||
field1:
|
field1:
|
||||||
- match: ''
|
- match: ""
|
||||||
set:
|
set:
|
||||||
- meta_content_scope: meta.field-1.csv support.type
|
- meta_content_scope: meta.field-1.csv support.type
|
||||||
- include: field_contents
|
- include: field_contents
|
||||||
field2:
|
field2:
|
||||||
- match: ''
|
- match: ""
|
||||||
set:
|
set:
|
||||||
- meta_content_scope: meta.field-2.csv support.function
|
- meta_content_scope: meta.field-2.csv support.function
|
||||||
- include: field_contents
|
- include: field_contents
|
||||||
field3:
|
field3:
|
||||||
- match: ''
|
- match: ""
|
||||||
set:
|
set:
|
||||||
- meta_content_scope: meta.field-3.csv constant.numeric
|
- meta_content_scope: meta.field-3.csv constant.numeric
|
||||||
- include: field_contents
|
- include: field_contents
|
||||||
field4:
|
field4:
|
||||||
- match: ''
|
- match: ""
|
||||||
set:
|
set:
|
||||||
- meta_content_scope: meta.field-4.csv keyword.operator
|
- meta_content_scope: meta.field-4.csv keyword.operator
|
||||||
- include: field_contents
|
- include: field_contents
|
||||||
|
|
||||||
|
@ -616,63 +616,59 @@ iconv -f ISO-8859-1 -t UTF-8 my-file.php | bat
|
|||||||
|
|
||||||
注意: 当`bat`无法识别语言时你可能会需要`-l`/`--language`参数。
|
注意: 当`bat`无法识别语言时你可能会需要`-l`/`--language`参数。
|
||||||
|
|
||||||
## Development
|
## 开发
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Recursive clone to retrieve all submodules
|
# 递归 clone 以获取所有子模块
|
||||||
git clone --recursive https://github.com/sharkdp/bat
|
git clone --recursive https://github.com/sharkdp/bat
|
||||||
|
|
||||||
# Build (debug version)
|
# 构建(调试版本)
|
||||||
cd bat
|
cd bat
|
||||||
cargo build --bins
|
cargo build --bins
|
||||||
|
|
||||||
# Run unit tests and integration tests
|
# 运行单元测试和集成测试
|
||||||
cargo test
|
cargo test
|
||||||
|
|
||||||
# Install (release version)
|
# 安装(发布版本)
|
||||||
cargo install --path . --locked
|
cargo install --path . --locked
|
||||||
|
|
||||||
# Build a bat binary with modified syntaxes and themes
|
# 使用修改后的语法和主题构建一个 bat 二进制文件
|
||||||
bash assets/create.sh
|
bash assets/create.sh
|
||||||
cargo install --path . --locked --force
|
cargo install --path . --locked --force
|
||||||
```
|
```
|
||||||
|
|
||||||
If you want to build an application that uses `bat`s pretty-printing
|
如果你想构建一个使用 `bat` 美化打印功能的应用程序,请查看 [API 文档](https://docs.rs/bat/)。请注意,当你依赖 `bat` 作为库时,必须使用 `regex-onig` 或 `regex-fancy` 作为特性。
|
||||||
features as a library, check out the [the API documentation](https://docs.rs/bat/).
|
|
||||||
Note that you have to use either `regex-onig` or `regex-fancy` as a feature
|
|
||||||
when you depend on `bat` as a library.
|
|
||||||
|
|
||||||
## Contributing
|
## 贡献指南
|
||||||
|
|
||||||
Take a look at the [`CONTRIBUTING.md`](CONTRIBUTING.md) guide.
|
请查看 [`CONTRIBUTING.md`](CONTRIBUTING.md) 指南。
|
||||||
|
|
||||||
## Maintainers
|
## 维护者
|
||||||
|
|
||||||
- [sharkdp](https://github.com/sharkdp)
|
- [sharkdp](https://github.com/sharkdp)
|
||||||
- [eth-p](https://github.com/eth-p)
|
- [eth-p](https://github.com/eth-p)
|
||||||
- [keith-hall](https://github.com/keith-hall)
|
- [keith-hall](https://github.com/keith-hall)
|
||||||
- [Enselic](https://github.com/Enselic)
|
- [Enselic](https://github.com/Enselic)
|
||||||
|
|
||||||
## Security vulnerabilities
|
## 安全漏洞
|
||||||
|
|
||||||
Please contact [David Peter](https://david-peter.de/) via email if you want to report a vulnerability in `bat`.
|
如果你想报告 `bat` 中的漏洞,请通过邮件联系 [David Peter](https://david-peter.de/)。
|
||||||
|
|
||||||
## Project goals and alternatives
|
## 项目目标和替代方案
|
||||||
|
|
||||||
`bat` tries to achieve the following goals:
|
`bat` 试图实现以下目标:
|
||||||
|
|
||||||
- Provide beautiful, advanced syntax highlighting
|
- 提供美观的高级语法高亮
|
||||||
- Integrate with Git to show file modifications
|
- 与 Git 集成以显示文件修改
|
||||||
- Be a drop-in replacement for (POSIX) `cat`
|
- 成为 (POSIX) `cat` 的替代品
|
||||||
- Offer a user-friendly command-line interface
|
- 提供用户友好的命令行界面
|
||||||
|
|
||||||
There are a lot of alternatives, if you are looking for similar programs. See
|
如果你在寻找类似的程序,有很多替代方案。请参阅[本文档](doc/alternatives.md)进行比较。
|
||||||
[this document](doc/alternatives.md) for a comparison.
|
|
||||||
|
|
||||||
## License
|
## 许可证
|
||||||
|
|
||||||
Copyright (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat).
|
版权所有 (c) 2018-2021 [bat-developers](https://github.com/sharkdp/bat)。
|
||||||
|
|
||||||
`bat` is made available under the terms of either the MIT License or the Apache License 2.0, at your option.
|
`bat` 可根据 MIT 许可证或 Apache 许可证 2.0 的条款使用,任选其一。
|
||||||
|
|
||||||
See the [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) files for license details.
|
有关许可证的详细信息,请参阅 [LICENSE-APACHE](LICENSE-APACHE) 和 [LICENSE-MIT](LICENSE-MIT) 文件。
|
||||||
|
@ -20,6 +20,13 @@ Options:
|
|||||||
* unicode (␇, ␊, ␀, ..)
|
* unicode (␇, ␊, ␀, ..)
|
||||||
* caret (^G, ^J, ^@, ..)
|
* caret (^G, ^J, ^@, ..)
|
||||||
|
|
||||||
|
--binary <behavior>
|
||||||
|
How to treat binary content. (default: no-printing)
|
||||||
|
|
||||||
|
Possible values:
|
||||||
|
* no-printing: do not print any binary content
|
||||||
|
* as-text: treat binary content as normal text
|
||||||
|
|
||||||
-p, --plain...
|
-p, --plain...
|
||||||
Only show plain style, no decorations. This is an alias for '--style=plain'. When '-p' is
|
Only show plain style, no decorations. This is an alias for '--style=plain'. When '-p' is
|
||||||
used twice ('-pp'), it also disables automatic paging (alias for '--style=plain
|
used twice ('-pp'), it also disables automatic paging (alias for '--style=plain
|
||||||
|
@ -11,6 +11,8 @@ Options:
|
|||||||
Show non-printable characters (space, tab, newline, ..).
|
Show non-printable characters (space, tab, newline, ..).
|
||||||
--nonprintable-notation <notation>
|
--nonprintable-notation <notation>
|
||||||
Set notation for non-printable characters.
|
Set notation for non-printable characters.
|
||||||
|
--binary <behavior>
|
||||||
|
How to treat binary content. (default: no-printing)
|
||||||
-p, --plain...
|
-p, --plain...
|
||||||
Show plain style (alias for '--style=plain').
|
Show plain style (alias for '--style=plain').
|
||||||
-l, --language <language>
|
-l, --language <language>
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 79 KiB After Width: | Height: | Size: 130 KiB |
@ -10,6 +10,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use bat::style::StyleComponentList;
|
use bat::style::StyleComponentList;
|
||||||
use bat::theme::{theme, ThemeName, ThemeOptions, ThemePreference};
|
use bat::theme::{theme, ThemeName, ThemeOptions, ThemePreference};
|
||||||
|
use bat::BinaryBehavior;
|
||||||
use bat::StripAnsiMode;
|
use bat::StripAnsiMode;
|
||||||
use clap::ArgMatches;
|
use clap::ArgMatches;
|
||||||
|
|
||||||
@ -97,12 +98,30 @@ impl App {
|
|||||||
pub fn config(&self, inputs: &[Input]) -> Result<Config> {
|
pub fn config(&self, inputs: &[Input]) -> Result<Config> {
|
||||||
let style_components = self.style_components()?;
|
let style_components = self.style_components()?;
|
||||||
|
|
||||||
|
let extra_plain = self.matches.get_count("plain") > 1;
|
||||||
|
let plain_last_index = self
|
||||||
|
.matches
|
||||||
|
.indices_of("plain")
|
||||||
|
.and_then(Iterator::max)
|
||||||
|
.unwrap_or_default();
|
||||||
|
let paging_last_index = self
|
||||||
|
.matches
|
||||||
|
.indices_of("paging")
|
||||||
|
.and_then(Iterator::max)
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
let paging_mode = match self.matches.get_one::<String>("paging").map(|s| s.as_str()) {
|
let paging_mode = match self.matches.get_one::<String>("paging").map(|s| s.as_str()) {
|
||||||
Some("always") => PagingMode::Always,
|
Some("always") => {
|
||||||
|
// Disable paging if the second -p (or -pp) is specified after --paging=always
|
||||||
|
if extra_plain && plain_last_index > paging_last_index {
|
||||||
|
PagingMode::Never
|
||||||
|
} else {
|
||||||
|
PagingMode::Always
|
||||||
|
}
|
||||||
|
}
|
||||||
Some("never") => PagingMode::Never,
|
Some("never") => PagingMode::Never,
|
||||||
Some("auto") | None => {
|
Some("auto") | None => {
|
||||||
// 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.
|
||||||
let extra_plain = self.matches.get_count("plain") > 1;
|
|
||||||
if extra_plain || self.matches.get_flag("no-paging") {
|
if extra_plain || self.matches.get_flag("no-paging") {
|
||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
} else if inputs.iter().any(Input::is_stdin) {
|
} else if inputs.iter().any(Input::is_stdin) {
|
||||||
@ -193,6 +212,11 @@ impl App {
|
|||||||
Some("caret") => NonprintableNotation::Caret,
|
Some("caret") => NonprintableNotation::Caret,
|
||||||
_ => unreachable!("other values for --nonprintable-notation are not allowed"),
|
_ => unreachable!("other values for --nonprintable-notation are not allowed"),
|
||||||
},
|
},
|
||||||
|
binary: match self.matches.get_one::<String>("binary").map(|s| s.as_str()) {
|
||||||
|
Some("as-text") => BinaryBehavior::AsText,
|
||||||
|
Some("no-printing") => BinaryBehavior::NoPrinting,
|
||||||
|
_ => unreachable!("other values for --binary are not allowed"),
|
||||||
|
},
|
||||||
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
wrapping_mode: if self.interactive_output || maybe_term_width.is_some() {
|
||||||
if !self.matches.get_flag("chop-long-lines") {
|
if !self.matches.get_flag("chop-long-lines") {
|
||||||
match self.matches.get_one::<String>("wrap").map(|s| s.as_str()) {
|
match self.matches.get_one::<String>("wrap").map(|s| s.as_str()) {
|
||||||
|
@ -77,11 +77,26 @@ pub fn build_app(interactive_output: bool) -> Command {
|
|||||||
* caret (^G, ^J, ^@, ..)",
|
* caret (^G, ^J, ^@, ..)",
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::new("binary")
|
||||||
|
.long("binary")
|
||||||
|
.action(ArgAction::Set)
|
||||||
|
.default_value("no-printing")
|
||||||
|
.value_parser(["no-printing", "as-text"])
|
||||||
|
.value_name("behavior")
|
||||||
|
.hide_default_value(true)
|
||||||
|
.help("How to treat binary content. (default: no-printing)")
|
||||||
|
.long_help(
|
||||||
|
"How to treat binary content. (default: no-printing)\n\n\
|
||||||
|
Possible values:\n \
|
||||||
|
* no-printing: do not print any binary content\n \
|
||||||
|
* as-text: treat binary content as normal text",
|
||||||
|
),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("plain")
|
Arg::new("plain")
|
||||||
.overrides_with("plain")
|
.overrides_with("plain")
|
||||||
.overrides_with("number")
|
.overrides_with("number")
|
||||||
.overrides_with("paging")
|
|
||||||
.short('p')
|
.short('p')
|
||||||
.long("plain")
|
.long("plain")
|
||||||
.action(ArgAction::Count)
|
.action(ArgAction::Count)
|
||||||
@ -306,7 +321,6 @@ pub fn build_app(interactive_output: bool) -> Command {
|
|||||||
.long("paging")
|
.long("paging")
|
||||||
.overrides_with("paging")
|
.overrides_with("paging")
|
||||||
.overrides_with("no-paging")
|
.overrides_with("no-paging")
|
||||||
.overrides_with("plain")
|
|
||||||
.value_name("when")
|
.value_name("when")
|
||||||
.value_parser(["auto", "never", "always"])
|
.value_parser(["auto", "never", "always"])
|
||||||
.default_value("auto")
|
.default_value("auto")
|
||||||
|
@ -208,7 +208,7 @@ pub fn list_themes(
|
|||||||
|
|
||||||
let default_theme_name = default_theme(color_scheme(detect_color_scheme).unwrap_or_default());
|
let default_theme_name = default_theme(color_scheme(detect_color_scheme).unwrap_or_default());
|
||||||
for theme in assets.themes() {
|
for theme in assets.themes() {
|
||||||
let default_theme_info = if default_theme_name == theme {
|
let default_theme_info = if !config.loop_through && default_theme_name == theme {
|
||||||
" (default)"
|
" (default)"
|
||||||
} else if default_theme(ColorScheme::Dark) == theme {
|
} else if default_theme(ColorScheme::Dark) == theme {
|
||||||
" (default dark)"
|
" (default dark)"
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use crate::line_range::{HighlightedLineRanges, LineRanges};
|
use crate::line_range::{HighlightedLineRanges, LineRanges};
|
||||||
use crate::nonprintable_notation::NonprintableNotation;
|
use crate::nonprintable_notation::{BinaryBehavior, NonprintableNotation};
|
||||||
#[cfg(feature = "paging")]
|
#[cfg(feature = "paging")]
|
||||||
use crate::paging::PagingMode;
|
use crate::paging::PagingMode;
|
||||||
use crate::style::StyleComponents;
|
use crate::style::StyleComponents;
|
||||||
@ -44,6 +44,9 @@ pub struct Config<'a> {
|
|||||||
/// The configured notation for non-printable characters
|
/// The configured notation for non-printable characters
|
||||||
pub nonprintable_notation: NonprintableNotation,
|
pub nonprintable_notation: NonprintableNotation,
|
||||||
|
|
||||||
|
/// How to treat binary content
|
||||||
|
pub binary: BinaryBehavior,
|
||||||
|
|
||||||
/// The character width of the terminal
|
/// The character width of the terminal
|
||||||
pub term_width: usize,
|
pub term_width: usize,
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ pub mod theme;
|
|||||||
mod vscreen;
|
mod vscreen;
|
||||||
pub(crate) mod wrapping;
|
pub(crate) mod wrapping;
|
||||||
|
|
||||||
pub use nonprintable_notation::NonprintableNotation;
|
pub use nonprintable_notation::{BinaryBehavior, NonprintableNotation};
|
||||||
pub use preprocessor::StripAnsiMode;
|
pub use preprocessor::StripAnsiMode;
|
||||||
pub use pretty_printer::{Input, PrettyPrinter, Syntax};
|
pub use pretty_printer::{Input, PrettyPrinter, Syntax};
|
||||||
pub use syntax_mapping::{MappingTarget, SyntaxMapping};
|
pub use syntax_mapping::{MappingTarget, SyntaxMapping};
|
||||||
|
@ -10,3 +10,15 @@ pub enum NonprintableNotation {
|
|||||||
#[default]
|
#[default]
|
||||||
Unicode,
|
Unicode,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// How to treat binary content
|
||||||
|
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
|
#[non_exhaustive]
|
||||||
|
pub enum BinaryBehavior {
|
||||||
|
/// Do not print any binary content
|
||||||
|
#[default]
|
||||||
|
NoPrinting,
|
||||||
|
|
||||||
|
/// Treat binary content as normal text
|
||||||
|
AsText,
|
||||||
|
}
|
||||||
|
@ -35,6 +35,7 @@ use crate::style::StyleComponent;
|
|||||||
use crate::terminal::{as_terminal_escaped, to_ansi_color};
|
use crate::terminal::{as_terminal_escaped, to_ansi_color};
|
||||||
use crate::vscreen::{AnsiStyle, EscapeSequence, EscapeSequenceIterator};
|
use crate::vscreen::{AnsiStyle, EscapeSequence, EscapeSequenceIterator};
|
||||||
use crate::wrapping::WrappingMode;
|
use crate::wrapping::WrappingMode;
|
||||||
|
use crate::BinaryBehavior;
|
||||||
use crate::StripAnsiMode;
|
use crate::StripAnsiMode;
|
||||||
|
|
||||||
const ANSI_UNDERLINE_ENABLE: EscapeSequence = EscapeSequence::CSI {
|
const ANSI_UNDERLINE_ENABLE: EscapeSequence = EscapeSequence::CSI {
|
||||||
@ -268,7 +269,8 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
.content_type
|
.content_type
|
||||||
.map_or(false, |c| c.is_binary() && !config.show_nonprintable);
|
.map_or(false, |c| c.is_binary() && !config.show_nonprintable);
|
||||||
|
|
||||||
let needs_to_match_syntax = !is_printing_binary
|
let needs_to_match_syntax = (!is_printing_binary
|
||||||
|
|| matches!(config.binary, BinaryBehavior::AsText))
|
||||||
&& (config.colored_output || config.strip_ansi == StripAnsiMode::Auto);
|
&& (config.colored_output || config.strip_ansi == StripAnsiMode::Auto);
|
||||||
|
|
||||||
let (is_plain_text, highlighter_from_set) = if needs_to_match_syntax {
|
let (is_plain_text, highlighter_from_set) = if needs_to_match_syntax {
|
||||||
@ -458,7 +460,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !self.config.style_components.header() {
|
if !self.config.style_components.header() {
|
||||||
if Some(ContentType::BINARY) == self.content_type && !self.config.show_nonprintable {
|
if Some(ContentType::BINARY) == self.content_type
|
||||||
|
&& !self.config.show_nonprintable
|
||||||
|
&& !matches!(self.config.binary, BinaryBehavior::AsText)
|
||||||
|
{
|
||||||
writeln!(
|
writeln!(
|
||||||
handle,
|
handle,
|
||||||
"{}: Binary content from {} will not be printed to the terminal \
|
"{}: Binary content from {} will not be printed to the terminal \
|
||||||
@ -539,7 +544,10 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
})?;
|
})?;
|
||||||
|
|
||||||
if self.config.style_components.grid() {
|
if self.config.style_components.grid() {
|
||||||
if self.content_type.map_or(false, |c| c.is_text()) || self.config.show_nonprintable {
|
if self.content_type.map_or(false, |c| c.is_text())
|
||||||
|
|| self.config.show_nonprintable
|
||||||
|
|| matches!(self.config.binary, BinaryBehavior::AsText)
|
||||||
|
{
|
||||||
self.print_horizontal_line(handle, '┼')?;
|
self.print_horizontal_line(handle, '┼')?;
|
||||||
} else {
|
} else {
|
||||||
self.print_horizontal_line(handle, '┴')?;
|
self.print_horizontal_line(handle, '┴')?;
|
||||||
@ -551,7 +559,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
|
|
||||||
fn print_footer(&mut self, handle: &mut OutputHandle, _input: &OpenedInput) -> Result<()> {
|
fn print_footer(&mut self, handle: &mut OutputHandle, _input: &OpenedInput) -> Result<()> {
|
||||||
if self.config.style_components.grid()
|
if self.config.style_components.grid()
|
||||||
&& (self.content_type.map_or(false, |c| c.is_text()) || self.config.show_nonprintable)
|
&& (self.content_type.map_or(false, |c| c.is_text())
|
||||||
|
|| self.config.show_nonprintable
|
||||||
|
|| matches!(self.config.binary, BinaryBehavior::AsText))
|
||||||
{
|
{
|
||||||
self.print_horizontal_line(handle, '┴')
|
self.print_horizontal_line(handle, '┴')
|
||||||
} else {
|
} else {
|
||||||
@ -599,7 +609,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
.into()
|
.into()
|
||||||
} else {
|
} else {
|
||||||
let mut line = match self.content_type {
|
let mut line = match self.content_type {
|
||||||
Some(ContentType::BINARY) | None => {
|
Some(ContentType::BINARY) | None
|
||||||
|
if !matches!(self.config.binary, BinaryBehavior::AsText) =>
|
||||||
|
{
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
Some(ContentType::UTF_16LE) => UTF_16LE.decode_with_bom_removal(line_buffer).0,
|
Some(ContentType::UTF_16LE) => UTF_16LE.decode_with_bom_removal(line_buffer).0,
|
||||||
|
3
src/syntax_mapping/builtins/common/50-diff.toml
Normal file
3
src/syntax_mapping/builtins/common/50-diff.toml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# .debdiff is the extension used for diffs in Debian packaging
|
||||||
|
[mappings]
|
||||||
|
"Diff" = ["*.debdiff"]
|
@ -1,3 +1,3 @@
|
|||||||
# JSON Lines is a simple variation of JSON #2535
|
# JSON Lines is a simple variation of JSON #2535
|
||||||
[mappings]
|
[mappings]
|
||||||
"JSON" = ["*.jsonl", "*.jsonc", "*.jsonld"]
|
"JSON" = ["*.jsonl", "*.jsonc", "*.jsonld", "*.geojson"]
|
||||||
|
2
src/syntax_mapping/builtins/common/50-markdown.toml
Normal file
2
src/syntax_mapping/builtins/common/50-markdown.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[mappings]
|
||||||
|
"Markdown" = ["*.mkd"]
|
2
src/syntax_mapping/builtins/linux/50-kubernetes.toml
Normal file
2
src/syntax_mapping/builtins/linux/50-kubernetes.toml
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[mappings]
|
||||||
|
"YAML" = ["/etc/kubernetes/*.conf"]
|
@ -1,3 +1,8 @@
|
|||||||
[mappings]
|
[mappings]
|
||||||
# pacman hooks
|
"INI" = [
|
||||||
"INI" = ["/usr/share/libalpm/hooks/*.hook", "/etc/pacman.d/hooks/*.hook"]
|
# config
|
||||||
|
"/etc/pacman.conf",
|
||||||
|
# hooks
|
||||||
|
"/usr/share/libalpm/hooks/*.hook",
|
||||||
|
"/etc/pacman.d/hooks/*.hook",
|
||||||
|
]
|
||||||
|
@ -9,7 +9,6 @@ use tempfile::tempdir;
|
|||||||
mod unix {
|
mod unix {
|
||||||
pub use std::fs::File;
|
pub use std::fs::File;
|
||||||
pub use std::io::{self, Write};
|
pub use std::io::{self, Write};
|
||||||
pub use std::os::unix::io::FromRawFd;
|
|
||||||
pub use std::path::PathBuf;
|
pub use std::path::PathBuf;
|
||||||
pub use std::process::Stdio;
|
pub use std::process::Stdio;
|
||||||
pub use std::thread;
|
pub use std::thread;
|
||||||
@ -295,6 +294,7 @@ fn list_themes_without_colors() {
|
|||||||
|
|
||||||
bat()
|
bat()
|
||||||
.arg("--color=never")
|
.arg("--color=never")
|
||||||
|
.arg("--decorations=always") // trick bat into setting `Config::loop_through` to false
|
||||||
.arg("--list-themes")
|
.arg("--list-themes")
|
||||||
.assert()
|
.assert()
|
||||||
.success()
|
.success()
|
||||||
@ -303,6 +303,15 @@ fn list_themes_without_colors() {
|
|||||||
.stdout(predicate::str::contains(default_light_theme_chunk).normalize());
|
.stdout(predicate::str::contains(default_light_theme_chunk).normalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn list_themes_to_piped_output() {
|
||||||
|
bat()
|
||||||
|
.arg("--list-themes")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout(predicate::str::contains("(default)").not());
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
|
#[cfg_attr(any(not(feature = "git"), target_os = "windows"), ignore)]
|
||||||
fn short_help() {
|
fn short_help() {
|
||||||
@ -403,8 +412,8 @@ fn no_args_doesnt_break() {
|
|||||||
// this test exists.
|
// this test exists.
|
||||||
|
|
||||||
let OpenptyResult { master, slave } = openpty(None, None).expect("Couldn't open pty.");
|
let OpenptyResult { master, slave } = openpty(None, None).expect("Couldn't open pty.");
|
||||||
let mut master = unsafe { File::from_raw_fd(master) };
|
let mut master = File::from(master);
|
||||||
let stdin_file = unsafe { File::from_raw_fd(slave) };
|
let stdin_file = File::from(slave);
|
||||||
let stdout_file = stdin_file.try_clone().unwrap();
|
let stdout_file = stdin_file.try_clone().unwrap();
|
||||||
let stdin = Stdio::from(stdin_file);
|
let stdin = Stdio::from(stdin_file);
|
||||||
let stdout = Stdio::from(stdout_file);
|
let stdout = Stdio::from(stdout_file);
|
||||||
@ -1008,6 +1017,31 @@ fn enable_pager_if_pp_flag_comes_before_paging() {
|
|||||||
.stdout(predicate::eq("pager-output\n").normalize());
|
.stdout(predicate::eq("pager-output\n").normalize());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn paging_does_not_override_simple_plain() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "echo pager-output")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.arg("--plain")
|
||||||
|
.arg("--paging=never")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout(predicate::eq("hello world\n"));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn simple_plain_does_not_override_paging() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "echo pager-output")
|
||||||
|
.arg("--paging=always")
|
||||||
|
.arg("--plain")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout(predicate::eq("pager-output\n"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn pager_failed_to_parse() {
|
fn pager_failed_to_parse() {
|
||||||
bat()
|
bat()
|
||||||
@ -1927,6 +1961,16 @@ fn show_all_with_unicode() {
|
|||||||
.stderr("");
|
.stderr("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn binary_as_text() {
|
||||||
|
bat()
|
||||||
|
.arg("--binary=as-text")
|
||||||
|
.arg("control_characters.txt")
|
||||||
|
.assert()
|
||||||
|
.stdout("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F\x7F")
|
||||||
|
.stderr("");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn no_paging_arg() {
|
fn no_paging_arg() {
|
||||||
bat()
|
bat()
|
||||||
|
Loading…
Reference in New Issue
Block a user