mirror of
https://github.com/sharkdp/bat.git
synced 2025-11-01 07:32:01 +00:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
490e1580ad | ||
|
|
cbfbfc8ff3 | ||
|
|
b6edf7ab0b | ||
|
|
65e6b4de69 | ||
|
|
2ca62e25f1 | ||
|
|
1b2a814478 | ||
|
|
e33967aa39 | ||
|
|
a1adefce36 | ||
|
|
6e87e02e96 | ||
|
|
ab9cc674d5 | ||
|
|
5371426588 | ||
|
|
4e13c3eb5b | ||
|
|
7e55608975 | ||
|
|
4bd5cbca8e | ||
|
|
7c3fa7e1ce | ||
|
|
3188a147d8 | ||
|
|
926fbc4b13 | ||
|
|
006d77fa39 | ||
|
|
52a792d46f | ||
|
|
20db989fb1 | ||
|
|
2c63d3c792 |
21
CHANGELOG.md
21
CHANGELOG.md
@@ -1,3 +1,22 @@
|
||||
# unreleased
|
||||
|
||||
## Features
|
||||
|
||||
## Bugfixes
|
||||
|
||||
- Fix negative values of N not being parsed in <N:M> line ranges without `=` flag value separator, see #3442 (@lmmx)
|
||||
|
||||
## Other
|
||||
- Improve README documentation on pager options passed to less, see #3443 (@injust)
|
||||
|
||||
- Use more robust approach to escaping in Bash completions, see #3448 (@akinomyoga)
|
||||
|
||||
## Syntaxes
|
||||
|
||||
## Themes
|
||||
|
||||
## `bat` as a library
|
||||
|
||||
# v0.26.0
|
||||
|
||||
## Features
|
||||
@@ -29,7 +48,7 @@
|
||||
- Update base16 README links to community driven base16 work #2871 (@JamyGolden)
|
||||
- Work around build failures when building `bat` from vendored sources #3179 (@dtolnay)
|
||||
- CICD: Stop building for x86_64-pc-windows-gnu which fails #3261 (Enselic)
|
||||
- CICD: CICD: replace windows-2019 runners with windows-2025 #3339 (@cyqsimon)
|
||||
- CICD: replace windows-2019 runners with windows-2025 #3339 (@cyqsimon)
|
||||
- Build script: replace string-based codegen with quote-based codegen #3340 (@cyqsimon)
|
||||
- Improve code coverage of `--list-languages` parameter #2942 (@sblondon)
|
||||
- Only start offload worker thread when there's more than 1 core #2956 (@cyqsimon)
|
||||
|
||||
100
Cargo.lock
generated
100
Cargo.lock
generated
@@ -394,9 +394,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.10"
|
||||
version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989"
|
||||
checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"darling_macro",
|
||||
@@ -404,9 +404,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_core"
|
||||
version = "0.20.10"
|
||||
version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5"
|
||||
checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4"
|
||||
dependencies = [
|
||||
"fnv",
|
||||
"ident_case",
|
||||
@@ -418,9 +418,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "darling_macro"
|
||||
version = "0.20.10"
|
||||
version = "0.21.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806"
|
||||
checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81"
|
||||
dependencies = [
|
||||
"darling_core",
|
||||
"quote",
|
||||
@@ -667,9 +667,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "git2"
|
||||
version = "0.20.0"
|
||||
version = "0.20.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3fda788993cc341f69012feba8bf45c0ba4f3291fcc08e214b4d5a7332d88aff"
|
||||
checksum = "2deb07a133b1520dc1a5690e9bd08950108873d7ed5de38dcc74d3b5ebffa110"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
"libc",
|
||||
@@ -932,9 +932,9 @@ checksum = "6a82ae493e598baaea5209805c49bbf2ea7de956d50d7da0da1164f9c6d28543"
|
||||
|
||||
[[package]]
|
||||
name = "libgit2-sys"
|
||||
version = "0.18.0+1.9.0"
|
||||
version = "0.18.2+1.9.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1a117465e7e1597e8febea8bb0c410f1c7fb93b1e1cddf34363f8390367ffec"
|
||||
checksum = "1c42fe03df2bd3c53a3a9c7317ad91d80c81cd1fb0caec8d7cc4cd2bfa10c222"
|
||||
dependencies = [
|
||||
"cc",
|
||||
"libc",
|
||||
@@ -1032,13 +1032,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "mio"
|
||||
version = "1.0.3"
|
||||
version = "1.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2886843bf800fba2e3377cff24abf6379b4c4d5c6681eaf9ea5b0d15090450bd"
|
||||
checksum = "69d83b0086dc8ecf3ce9ae2874b2d1290252e2a30720bea58a5c6639b0092873"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"wasi 0.11.0+wasi-snapshot-preview1",
|
||||
"windows-sys 0.52.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -1218,9 +1218,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "prettyplease"
|
||||
version = "0.2.35"
|
||||
version = "0.2.37"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "061c1221631e079b26479d25bbf2275bfe5917ae8419cd7e34f13bfc2aa7539a"
|
||||
checksum = "479ca8adacdd7ce8f1fb39ce9ecccbfe93a3f1344b3d0d97f20bc0196208f62b"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"syn",
|
||||
@@ -1284,9 +1284,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex"
|
||||
version = "1.11.1"
|
||||
version = "1.12.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191"
|
||||
checksum = "843bc0191f75f3e22651ae5f1e72939ab2f72a4bc30fa80a066bd66edefc24d4"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1296,9 +1296,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "regex-automata"
|
||||
version = "0.4.9"
|
||||
version = "0.4.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908"
|
||||
checksum = "5276caf25ac86c8d810222b3dbb938e512c55c6831a10f3e6ed1c93b84041f1c"
|
||||
dependencies = [
|
||||
"aho-corasick",
|
||||
"memchr",
|
||||
@@ -1362,18 +1362,28 @@ checksum = "f79dfe2d285b0488816f30e700a7438c5a73d816b5b7d3ac72fbc48b0d185e03"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.217"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "02fc4265df13d6fa1d00ecff087228cc0a2b5f3c0e87e258d8b94a156e984c70"
|
||||
checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"
|
||||
dependencies = [
|
||||
"serde_core",
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_core"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"
|
||||
dependencies = [
|
||||
"serde_derive",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_derive"
|
||||
version = "1.0.217"
|
||||
version = "1.0.228"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5a9bf7cf98d04a2b28aead066b7496853d4779c9cc183c440dbac457641e19a0"
|
||||
checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1403,20 +1413,19 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "serde_with"
|
||||
version = "3.12.0"
|
||||
version = "3.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa"
|
||||
checksum = "aa66c845eee442168b2c8134fec70ac50dc20e760769c8ba0ad1319ca1959b04"
|
||||
dependencies = [
|
||||
"serde",
|
||||
"serde_derive",
|
||||
"serde_core",
|
||||
"serde_with_macros",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "serde_with_macros"
|
||||
version = "3.12.0"
|
||||
version = "3.15.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e"
|
||||
checksum = "b91a903660542fced4e99881aa481bdbaec1634568ee02e0b8bd57c64cb38955"
|
||||
dependencies = [
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
@@ -1534,9 +1543,9 @@ checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"
|
||||
|
||||
[[package]]
|
||||
name = "syn"
|
||||
version = "2.0.104"
|
||||
version = "2.0.108"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "17b6f705963418cdb9927482fa304bc562ece2fdd4f616084c50b7023b435a40"
|
||||
checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@@ -1615,28 +1624,28 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "terminal-colorsaurus"
|
||||
version = "1.0.0"
|
||||
version = "1.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3f7226dad4b1817567c1e2f5d453897ef36abe79def7783af3fa241a694e30b3"
|
||||
checksum = "8909f33134da34b43f69145e748790de650a6abd84faf1f82e773444dd293ec8"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio 1.0.3",
|
||||
"mio 1.1.0",
|
||||
"terminal-trx",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
"xterm-color",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "terminal-trx"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "975b4233aefa1b02456d5e53b22c61653c743e308c51cf4181191d8ce41753ab"
|
||||
checksum = "662a3cd5ca570df622e848ef18b50c151e65c9835257465417242243b0bce783"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"windows-sys 0.59.0",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -2011,6 +2020,12 @@ dependencies = [
|
||||
"syn",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.1.2"
|
||||
@@ -2056,6 +2071,15 @@ dependencies = [
|
||||
"windows-targets 0.53.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-sys"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-targets"
|
||||
version = "0.48.5"
|
||||
|
||||
@@ -67,7 +67,7 @@ clircle = { version = "0.6.1", default-features = false }
|
||||
bugreport = { version = "0.5.0", optional = true }
|
||||
etcetera = { version = "0.10.0", optional = true }
|
||||
grep-cli = { version = "0.1.11", optional = true }
|
||||
regex = { version = "1.10.6", optional = true }
|
||||
regex = { version = "1.12.2", optional = true }
|
||||
walkdir = { version = "2.5", optional = true }
|
||||
bytesize = { version = "1.3.0" }
|
||||
encoding_rs = "0.8.35"
|
||||
@@ -112,13 +112,13 @@ anyhow = "1.0.97"
|
||||
indexmap = { version = "2.8.0", features = ["serde"] }
|
||||
itertools = "0.14.0"
|
||||
once_cell = "1.20"
|
||||
prettyplease = "0.2.35"
|
||||
prettyplease = "0.2.37"
|
||||
proc-macro2 = "1.0.95"
|
||||
quote = "1.0.40"
|
||||
regex = "1.10.6"
|
||||
regex = "1.12.2"
|
||||
serde = "1.0"
|
||||
serde_derive = "1.0"
|
||||
serde_with = { version = "3.12.0", default-features = false, features = ["macros"] }
|
||||
serde_with = { version = "3.15.1", default-features = false, features = ["macros"] }
|
||||
syn = { version = "2.0.104", features = ["full"] }
|
||||
toml = { version = "0.9.1", features = ["preserve_order"] }
|
||||
walkdir = "2.5"
|
||||
|
||||
12
README.md
12
README.md
@@ -670,22 +670,22 @@ to improve the experience. Specifically, `-R`/`--RAW-CONTROL-CHARS`, `-F`/`--qui
|
||||
> - The `--paging=always` argument is used.
|
||||
> - The `BAT_PAGING` environment is set to `always`.
|
||||
|
||||
The `-R` option is needed to interpret ANSI colors correctly.
|
||||
The `-R`/`--RAW-CONTROL-CHARS` option is needed to interpret ANSI colors correctly.
|
||||
|
||||
The `-F` option instructs `less` to exit immediately if the output size is smaller than
|
||||
The `-F`/`--quit-if-one-screen` option instructs `less` to exit immediately if the output size is smaller than
|
||||
the vertical size of the terminal. This is convenient for small files because you do not
|
||||
have to press `q` to quit the pager.
|
||||
|
||||
The `-K` option instructs `less` to exit immediately when an interrupt signal is received.
|
||||
The `-K`/`--quit-on-intr` option instructs `less` to exit immediately when an interrupt signal is received.
|
||||
This is useful to ensure that `less` quits together with `bat` on SIGINT.
|
||||
|
||||
The `-X` option is needed to fix a bug with the `--quit-if-one-screen` feature in versions
|
||||
of `less` older than version 530. Unfortunately, it also breaks mouse-wheel support in `less`.
|
||||
The `-X`/`--no-init` option is added to versions of `less` older than version 530 (older than 558 on Windows) to
|
||||
fix a bug with the `-F`/`--quit-if-one-screen` feature. Unfortunately, it also breaks mouse-wheel support in `less`.
|
||||
If you want to enable mouse-wheel scrolling on older versions of `less` and do not mind losing
|
||||
the quit-if-one-screen feature, you can set the pager (via `--pager` or `BAT_PAGER`) to `less -R`.
|
||||
For `less` 530 or newer, it should work out of the box.
|
||||
|
||||
The `-S` option is added when `bat`'s `-S`/`--chop-long-lines` option is used. This tells `less`
|
||||
The `-S`/`--chop-long-lines` option is added when `bat`'s `-S`/`--chop-long-lines` option is used. This tells `less`
|
||||
to truncate any lines larger than the terminal width.
|
||||
|
||||
### Indentation
|
||||
|
||||
42
assets/completions/bat.bash.in
vendored
42
assets/completions/bat.bash.in
vendored
@@ -14,18 +14,36 @@ __bat_escape_completions()
|
||||
{
|
||||
# Do not escape if completing a quoted value.
|
||||
[[ $cur == [\"\']* ]] && return 0
|
||||
# printf -v to an array index is available in bash >= 4.1.
|
||||
# Use it if available, as -o filenames is semantically incorrect if
|
||||
# we are not actually completing filenames, and it has side effects
|
||||
# (e.g. adds trailing slash to candidates matching present dirs).
|
||||
if ((
|
||||
BASH_VERSINFO[0] > 5 || \
|
||||
BASH_VERSINFO[0] == 5 && BASH_VERSINFO[1] >= 3
|
||||
)); then
|
||||
# bash >= 5.3 has "compopt -o fullquote", which exactly does
|
||||
# what this function tries to do.
|
||||
compopt -o fullquote
|
||||
elif ((
|
||||
BASH_VERSINFO[0] > 4 || \
|
||||
BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] > 0
|
||||
)); then
|
||||
# printf -v to an array index is available in bash >= 4.1.
|
||||
# Use it if available, as -o filenames is semantically
|
||||
# incorrect if we are not actually completing filenames, and it
|
||||
# has side effects (e.g. adds trailing slash to candidates
|
||||
# matching present dirs).
|
||||
local i
|
||||
for i in ${!COMPREPLY[*]}; do
|
||||
printf -v "COMPREPLY[i]" %q "${COMPREPLY[i]}"
|
||||
done
|
||||
|
||||
# We can use "compopt -o noquote" available in bash >= 4.3 to
|
||||
# prevent further quoting by the shell, which would be
|
||||
# unexpectedly applied when a quoted result matches a filename.
|
||||
if ((
|
||||
BASH_VERSINFO[0] > 4 || \
|
||||
BASH_VERSINFO[0] == 4 && BASH_VERSINFO[1] >= 3
|
||||
)); then
|
||||
compopt -o noquote
|
||||
fi
|
||||
else
|
||||
compopt -o filenames
|
||||
fi
|
||||
@@ -66,7 +84,7 @@ _bat() {
|
||||
printf "%s\n" "$lang"
|
||||
done
|
||||
)" -- "$cur"))
|
||||
__bat_escape_completions
|
||||
__bat_escape_completions
|
||||
return 0
|
||||
;;
|
||||
-H | --highlight-line | \
|
||||
@@ -130,16 +148,16 @@ _bat() {
|
||||
return 0
|
||||
;;
|
||||
--theme)
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "auto${IFS}auto:always${IFS}auto:system${IFS}dark${IFS}light${IFS}$("$1" --list-themes)" -- "$cur"))
|
||||
__bat_escape_completions
|
||||
return 0
|
||||
;;
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "auto${IFS}auto:always${IFS}auto:system${IFS}dark${IFS}light${IFS}$("$1" --list-themes)" -- "$cur"))
|
||||
__bat_escape_completions
|
||||
return 0
|
||||
;;
|
||||
--theme-dark | \
|
||||
--theme-light)
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=($(compgen -W "$("$1" --list-themes)" -- "$cur"))
|
||||
__bat_escape_completions
|
||||
__bat_escape_completions
|
||||
return 0
|
||||
;;
|
||||
--style)
|
||||
@@ -158,7 +176,7 @@ _bat() {
|
||||
numbers
|
||||
snip
|
||||
)
|
||||
# shellcheck disable=SC2016
|
||||
# shellcheck disable=SC2016
|
||||
if declare -F _comp_delimited >/dev/null 2>&1; then
|
||||
# bash-completion > 2.11
|
||||
_comp_delimited , -W '"${styles[@]}"'
|
||||
|
||||
@@ -6,12 +6,12 @@ if you are not looking for a program like `bat`, this comparison might not be fo
|
||||
|
||||
| | bat | [pygments](http://pygments.org/) | [highlight](http://www.andre-simon.de/doku/highlight/highlight.php) | [ccat](https://github.com/jingweno/ccat) | [source-highlight](https://www.gnu.org/software/src-highlite/) | [hicat](https://github.com/rstacruz/hicat) | [coderay](https://github.com/rubychan/coderay) | [rouge](https://github.com/jneen/rouge) | [clp](https://github.com/jpe90/clp) |
|
||||
|----------------------------------------------|---------------------------------------------------------------------|----------------------------------|---------------------------------------------------------------------|------------------------------------------|----------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|
|
||||
| Drop-in `cat` replacement | :heavy_check_mark: [*](https://github.com/sharkdp/bat/issues/134) | :x: | :x: | (:heavy_check_mark:) | :x: | :x: [*](https://github.com/rstacruz/hicat/issues/6) | :x: | :x: | :x: |
|
||||
| Drop-in `cat` replacement | :heavy_check_mark: [*](https://github.com/sharkdp/bat/issues/134) | :x: | :x: | (✔️) | :x: | :x: [*](https://github.com/rstacruz/hicat/issues/6) | :x: | :x: | :x: |
|
||||
| Git integration | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
|
||||
| Automatic paging | :heavy_check_mark: | :x: | :x: | :x: | :x: | :heavy_check_mark: | :x: | :x: | :x: |
|
||||
| Languages (circa) | 150 | 300 | 200 | 7 | 80 | 130 | 30 | 130 | 150 |
|
||||
| Extensible (languages, themes) | :heavy_check_mark: | (:heavy_check_mark:) | (:heavy_check_mark:) | :x: | (:heavy_check_mark:) | :x: | :x: | :x: | :heavy_check_mark: |
|
||||
| Advanced highlighting (e.g. nested syntaxes) | :heavy_check_mark: | :heavy_check_mark: | (:heavy_check_mark:) ? | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
|
||||
| Extensible (languages, themes) | :heavy_check_mark: | (✔️) | (✔️) | :x: | (✔️) | :x: | :x: | :x: | :heavy_check_mark: |
|
||||
| Advanced highlighting (e.g. nested syntaxes) | :heavy_check_mark: | :heavy_check_mark: | (✔️) ? | :x: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
|
||||
| Execution time [ms] (`jquery-3.3.1.js`) | 422 | 455 | 299 | 39 | 208 | 287 | 128 | 740 | 22 |
|
||||
| Execution time [ms] (`miniz.c`) | 27 | 169 | 19 | 4 | 36 | 131 | 58 | 231 | 4 |
|
||||
| Execution time [ms] (957 kB XML file) | 215 | 296 | 236 | 165 | 83 | 412 | 135 | 386 | 127 |
|
||||
|
||||
@@ -194,6 +194,7 @@ Options:
|
||||
'--line-range :40' prints lines 1 to 40
|
||||
'--line-range 40:' prints lines 40 to the end of the file
|
||||
'--line-range 40' only prints line 40
|
||||
'--line-range -10:' prints the last 10 lines
|
||||
'--line-range 30:+10' prints lines 30 to 40
|
||||
'--line-range 35::5' prints lines 30 to 40 (line 35 with 5 lines of context)
|
||||
'--line-range 30:40:2' prints lines 28 to 42 (range 30-40 with 2 lines of context)
|
||||
|
||||
@@ -519,6 +519,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
.short('r')
|
||||
.action(ArgAction::Append)
|
||||
.value_name("N:M")
|
||||
.allow_hyphen_values(true)
|
||||
.help("Only print the lines from N to M.")
|
||||
.long_help(
|
||||
"Only print the specified range of lines for each file. \
|
||||
@@ -527,6 +528,7 @@ pub fn build_app(interactive_output: bool) -> Command {
|
||||
'--line-range :40' prints lines 1 to 40\n \
|
||||
'--line-range 40:' prints lines 40 to the end of the file\n \
|
||||
'--line-range 40' only prints line 40\n \
|
||||
'--line-range -10:' prints the last 10 lines\n \
|
||||
'--line-range 30:+10' prints lines 30 to 40\n \
|
||||
'--line-range 35::5' prints lines 30 to 40 (line 35 with 5 lines of context)\n \
|
||||
'--line-range 30:40:2' prints lines 28 to 42 (range 30-40 with 2 lines of context)",
|
||||
|
||||
@@ -207,7 +207,7 @@ fn line_range_from_back_last_two() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn line_range_from_back_last_two_single_line() {
|
||||
fn line_range_from_back_last_two_single_line_eq_sep() {
|
||||
bat()
|
||||
.arg("single-line.txt")
|
||||
.arg("--line-range=-2:")
|
||||
@@ -216,6 +216,17 @@ fn line_range_from_back_last_two_single_line() {
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn line_range_from_back_last_two_single_line_no_sep() {
|
||||
bat()
|
||||
.arg("single-line.txt")
|
||||
.arg("--line-range")
|
||||
.arg("-2:")
|
||||
.assert()
|
||||
.success()
|
||||
.stdout("Single Line");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn line_range_first_two() {
|
||||
bat()
|
||||
|
||||
Reference in New Issue
Block a user