1
0
mirror of https://github.com/sharkdp/bat.git synced 2025-09-01 10:52:24 +01:00

Compare commits

...

21 Commits

Author SHA1 Message Date
Keith Hall
6a6041c72c make further improvements to docs relating to sponsors 2022-02-09 22:41:59 +02:00
Keith Hall
0d93abde67 create separate sponsors.md file 2022-02-09 22:34:46 +02:00
Keith Hall
1cc39a790f improve sponsor section in readme 2022-02-09 22:26:12 +02:00
Keith Hall
2d93da1869 Add WorkOS sponsor to readme 2022-02-09 22:22:34 +02:00
dependabot[bot]
9ad147278f Bump assets/syntaxes/02_Extra/GLSL from 4cd4acf to 59a5f8a (#2050)
* Bump assets/syntaxes/02_Extra/GLSL from `4cd4acf` to `59a5f8a`

Bumps [assets/syntaxes/02_Extra/GLSL](https://github.com/euler0/sublime-glsl) from `4cd4acf` to `59a5f8a`.
- [Release notes](https://github.com/euler0/sublime-glsl/releases)
- [Commits](4cd4acfffc...59a5f8a312)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/GLSL
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update CHANGELOG.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2022-02-08 17:11:31 +01:00
Dan Davison
4e36a56014 Expose syntect theme and syntax sets (#2030)
Fixes #2026
Ref https://github.com/dandavison/delta/issues/895
2022-02-08 08:00:12 +01:00
Mahdi Dibaiee
312c8ef01f Add new --style called header-filesize and display it by default (#1988)
Also rename `header` to `header-filename`.

Related to #1701
2022-02-07 20:48:57 +01:00
dependabot[bot]
f3f8194932 Bump assets/syntaxes/02_Extra/GraphQL from 59304d6 to 9b6f6d0 (#2000)
* Bump assets/syntaxes/02_Extra/GraphQL from `59304d6` to `9b6f6d0`

Bumps [assets/syntaxes/02_Extra/GraphQL](https://github.com/dncrews/GraphQL-SublimeText3) from `59304d6` to `9b6f6d0`.
- [Release notes](https://github.com/dncrews/GraphQL-SublimeText3/releases)
- [Commits](59304d6c7b...9b6f6d0a86)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/GraphQL
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update CHANGELOG.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2022-02-07 17:34:35 +01:00
dependabot[bot]
6ce26c43c9 Bump ansi_colours from 1.0.4 to 1.1.1
Bumps [ansi_colours](https://github.com/mina86/ansi_colours) from 1.0.4 to 1.1.1.
- [Release notes](https://github.com/mina86/ansi_colours/releases)
- [Commits](https://github.com/mina86/ansi_colours/compare/v1.0.4...v1.1.1)

---
updated-dependencies:
- dependency-name: ansi_colours
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-07 07:55:00 +01:00
Martin Nordholts
486510395b Allow the license used by GraphQL
This license is apparently common enough that GitHub recognizes it. See
https://github.com/dncrews/GraphQL-SublimeText3/blob/master/LICENSE.

This will fix the CI failure in #2000
2022-02-07 06:14:07 +01:00
dependabot[bot]
2ae4ffcdfa Bump assets/syntaxes/02_Extra/VimL from c91fe3a to ee85822 (#2002)
* Bump assets/syntaxes/02_Extra/VimL from `c91fe3a` to `ee85822`

Bumps [assets/syntaxes/02_Extra/VimL](https://github.com/SalGnt/Sublime-VimL) from `c91fe3a` to `ee85822`.
- [Release notes](https://github.com/SalGnt/Sublime-VimL/releases)
- [Commits](c91fe3ab02...ee85822cbe)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/VimL
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update CHANGELOG.md

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2022-02-06 22:29:36 +01:00
dependabot[bot]
f5a7f86a64 Bump assets/syntaxes/02_Extra/TOML from 6bfcc3c to ed38438 (#2049)
* Bump assets/syntaxes/02_Extra/TOML from `6bfcc3c` to `ed38438`

Bumps [assets/syntaxes/02_Extra/TOML](https://github.com/jasonwilliams/sublime_toml_highlighting) from `6bfcc3c` to `ed38438`.
- [Release notes](https://github.com/jasonwilliams/sublime_toml_highlighting/releases)
- [Commits](6bfcc3c236...ed38438900)

---
updated-dependencies:
- dependency-name: assets/syntaxes/02_Extra/TOML
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update CHANGELOG.md for PR #2049

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2022-02-06 21:20:24 +01:00
Martin Nordholts
0fa99518ce run-benchmarks.sh: Use python3 oneliner instead of jq
I am setting up a new computer and thus are missing a lot of tools. I
noticed we rely on `jq` being installed, which is a bit annoying when it
is not installed yet.

We can quite easily get rid of this dependecy on `jq` by using a simple
`python3` oneliner.
2022-02-03 08:00:14 +01:00
dependabot[bot]
a565662cf3 Bump serde from 1.0.133 to 1.0.136
Bumps [serde](https://github.com/serde-rs/serde) from 1.0.133 to 1.0.136.
- [Release notes](https://github.com/serde-rs/serde/releases)
- [Commits](https://github.com/serde-rs/serde/compare/v1.0.133...v1.0.136)

---
updated-dependencies:
- dependency-name: serde
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-01 17:20:43 +01:00
dependabot[bot]
af44f0b3ff Bump tempfile from 3.2.0 to 3.3.0
Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.2.0 to 3.3.0.
- [Release notes](https://github.com/Stebalien/tempfile/releases)
- [Changelog](https://github.com/Stebalien/tempfile/blob/master/NEWS)
- [Commits](https://github.com/Stebalien/tempfile/compare/v3.2.0...v3.3.0)

---
updated-dependencies:
- dependency-name: tempfile
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-01 17:19:46 +01:00
dependabot[bot]
5ae1957c0e Bump assert_cmd from 2.0.2 to 2.0.4
Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.2 to 2.0.4.
- [Release notes](https://github.com/assert-rs/assert_cmd/releases)
- [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md)
- [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.2...v2.0.4)

---
updated-dependencies:
- dependency-name: assert_cmd
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-01 17:09:00 +01:00
Keith Hall
36be8d5929 Update README.md
Co-authored-by: Michael <2701605+michaelblyons@users.noreply.github.com>
2022-01-29 18:17:59 +01:00
Keith Hall
a05c8ee1a8 README.md: Improve docs around --map-syntax argument based on feedback 2022-01-29 18:17:59 +01:00
Keith Hall
eb4b1eb28f README.md: Clarify --map-syntax argument 2022-01-29 18:17:59 +01:00
klemens
9287cf6b0b small typos, should not interrupt anything 2022-01-09 12:59:01 +01:00
Martin Nordholts
76aa138230 CHANGELOG.md: Prepare a new "unreleased" section 2022-01-08 20:05:43 +01:00
122 changed files with 420 additions and 119 deletions

View File

@@ -1,3 +1,26 @@
# unreleased
## Features
- New style component `header-filesize` to show size of the displayed file in the header. See #1988 (@mdibaiee)
## Bugfixes
## Other
## Syntaxes
- `GraphQL`: Add support for interfaces implementing interfaces and consider ampersand an operator. See #2000
- Associate `_vimrc` and `_gvimrc` files with the `VimL` syntax. See #2002
- Associate `poetry.lock` files with the `TOML` syntax. See #2049
- Associate `.mesh`, `.task`, `.rgen`, `.rint`, `.rahit`, `.rchit`, `.rmiss`, and `.rcall` with the `GLSL` syntax. See #2050
## Themes
## `bat` as a library
- Exposed `get_syntax_set` and `get_theme` methods on `HighlightingAssets`. See #2030 (@dandavison)
# v0.19.0 # v0.19.0
## Performance ## Performance

101
Cargo.lock generated
View File

@@ -19,11 +19,11 @@ dependencies = [
[[package]] [[package]]
name = "ansi_colours" name = "ansi_colours"
version = "1.0.4" version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "60e2fb6138a49ad9f1cb3c6d8f8ccbdd5e62b4dab317c1b435a47ecd7da1d28f" checksum = "32678233b67f9056b0c144b39d46dc3218637e8d84ad6038ded339e08b19620d"
dependencies = [ dependencies = [
"cc", "rgb",
] ]
[[package]] [[package]]
@@ -37,9 +37,9 @@ dependencies = [
[[package]] [[package]]
name = "assert_cmd" name = "assert_cmd"
version = "2.0.2" version = "2.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e996dc7940838b7ef1096b882e29ec30a3149a3a443cdc8dba19ed382eca1fe2" checksum = "93ae1ddd39efd67689deb1979d80bad3bf7f2b09c6e6117c8d1f2443b5e2f83e"
dependencies = [ dependencies = [
"bstr", "bstr",
"doc-comment", "doc-comment",
@@ -82,6 +82,7 @@ dependencies = [
"atty", "atty",
"bincode", "bincode",
"bugreport", "bugreport",
"bytesize",
"clap", "clap",
"clircle", "clircle",
"console", "console",
@@ -163,6 +164,18 @@ dependencies = [
"sys-info", "sys-info",
] ]
[[package]]
name = "bytemuck"
version = "1.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "439989e6b8c38d1b6570a384ef1e49c8848128f5a97f3914baef02920842712f"
[[package]]
name = "bytesize"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c58ec36aac5066d5ca17df51b3e70279f5670a72102f5752cb7e7c856adfc70"
[[package]] [[package]]
name = "cc" name = "cc"
version = "1.0.72" version = "1.0.72"
@@ -358,6 +371,15 @@ dependencies = [
"regex", "regex",
] ]
[[package]]
name = "fastrand"
version = "1.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c3fcf0cee53519c866c09b5de1f6c56ff9d647101f81c1964fa632e148896cdf"
dependencies = [
"instant",
]
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.22" version = "1.0.22"
@@ -774,12 +796,6 @@ dependencies = [
"xml-rs", "xml-rs",
] ]
[[package]]
name = "ppv-lite86"
version = "0.2.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eb9f9e6e233e5c4a35559a617bf40a4ec447db2e84c20b55a6f83167b7e57872"
[[package]] [[package]]
name = "predicates" name = "predicates"
version = "2.1.0" version = "2.1.0"
@@ -834,46 +850,6 @@ dependencies = [
"proc-macro2", "proc-macro2",
] ]
[[package]]
name = "rand"
version = "0.8.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e7573632e6454cf6b99d7aac4ccca54be06da05aca2ef7423d22d27d4d4bcd8"
dependencies = [
"libc",
"rand_chacha",
"rand_core",
"rand_hc",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
dependencies = [
"ppv-lite86",
"rand_core",
]
[[package]]
name = "rand_core"
version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d34f1408f55294453790c48b2f1ebbb1c5b4b7563eb1f418bcfcfdbb06ebb4e7"
dependencies = [
"getrandom",
]
[[package]]
name = "rand_hc"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d51e9f596de227fda2ea6c84607f5558e196eeaf43c986b724ba4fb8fdf497e7"
dependencies = [
"rand_core",
]
[[package]] [[package]]
name = "redox_syscall" name = "redox_syscall"
version = "0.2.10" version = "0.2.10"
@@ -925,6 +901,15 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "rgb"
version = "0.8.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9a374af9a0e5fdcdd98c1c7b64f05004f9ea2555b6c75f211daa81268a3c50f1"
dependencies = [
"bytemuck",
]
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "1.0.9" version = "1.0.9"
@@ -960,18 +945,18 @@ checksum = "568a8e6258aa33c13358f81fd834adb854c6f7c9468520910a9b1e8fac068012"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.133" version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "97565067517b60e2d1ea8b268e59ce036de907ac523ad83a0475da04e818989a" checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.133" version = "1.0.136"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed201699328568d8d08208fdd080e3ff594e6c422e438b6705905da01005d537" checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -1099,13 +1084,13 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.2.0" version = "3.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand",
"libc", "libc",
"rand",
"redox_syscall", "redox_syscall",
"remove_dir_all", "remove_dir_all",
"winapi", "winapi",

View File

@@ -43,7 +43,7 @@ regex-fancy = ["syntect/regex-fancy"] # Use the rust-only "fancy-regex" engine
[dependencies] [dependencies]
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.1"
bincode = "1.0" bincode = "1.0"
console = "0.15.0" console = "0.15.0"
flate2 = "1.0" flate2 = "1.0"
@@ -65,6 +65,7 @@ dirs-next = { version = "2.0.0", optional = true }
grep-cli = { version = "0.1.6", optional = true } grep-cli = { version = "0.1.6", optional = true }
regex = { version = "1.0", optional = true } regex = { version = "1.0", optional = true }
walkdir = { version = "2.0", optional = true } walkdir = { version = "2.0", optional = true }
bytesize = { version = "1.1.0" }
[dependencies.git2] [dependencies.git2]
version = "0.13" version = "0.13"
@@ -83,11 +84,11 @@ default-features = false
features = ["suggestions", "color", "wrap_help"] features = ["suggestions", "color", "wrap_help"]
[dev-dependencies] [dev-dependencies]
assert_cmd = "2.0.2" assert_cmd = "2.0.4"
serial_test = "0.5.1" serial_test = "0.5.1"
predicates = "2.1.0" predicates = "2.1.0"
wait-timeout = "0.2.0" wait-timeout = "0.2.0"
tempfile = "3.2.0" tempfile = "3.3.0"
[target.'cfg(unix)'.dev-dependencies] [target.'cfg(unix)'.dev-dependencies]
nix = "0.23.1" nix = "0.23.1"

View File

@@ -19,6 +19,19 @@
[<a href="doc/README-ru.md">Русский</a>] [<a href="doc/README-ru.md">Русский</a>]
</p> </p>
### Sponsors
a special thank you goes to our biggest <a href="doc/sponsors.md">sponsors</a>:<br>
<a href="https://workos.com/?utm_campaign=github_repo&utm_medium=referral&utm_content=bat&utm_source=github">
<img src="doc/sponsors/workos-logo-white-bg.svg" width="200" alt="WorkOS">
<br>
<strong>Your app, enterprise-ready.</strong>
<br>
<sub>Start selling to enterprise customers with just a few lines of code.</sub>
<br>
<sup>Add Single Sign-On (and more) in minutes instead of months.</sup>
</a>
### Syntax highlighting ### Syntax highlighting
`bat` supports syntax highlighting for a large number of programming and markup `bat` supports syntax highlighting for a large number of programming and markup
@@ -515,8 +528,9 @@ command line option. The option takes an argument of the form `pattern:syntax` w
the absolute file path. The `syntax` part is the full name of a supported language the absolute file path. The `syntax` part is the full name of a supported language
(use `bat --list-languages` for an overview). (use `bat --list-languages` for an overview).
Note: You probably want to use this option as an entry in `bat`s configuration file instead **Note:** You probably want to use this option as [an entry in `bat`'s configuration file](#configuration-file)
of passing it on the command line (see below). for persistence instead of passing it on the command line as a one-off. Generally
you'd just use `-l` if you want to manually specify a language for a file.
Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use Example: To use "INI" syntax highlighting for all files with a `.conf` file extension, use
```bash ```bash

View File

@@ -197,7 +197,7 @@ contexts:
scope: entity.other.attribute-name.stylus scope: entity.other.attribute-name.stylus
- match: |- - match: |-
(?x) # multi-line regex definition mode (?x) # multi-line regex definition mode
(?<=^|;|{)\s* # starts after begining of line, '{' or ';'' (?<=^|;|{)\s* # starts after beginning of line, '{' or ';''
(?= # lookahead for (?= # lookahead for
( (
[a-zA-Z0-9_-] # then a letter [a-zA-Z0-9_-] # then a letter
@@ -207,7 +207,7 @@ contexts:
(/\*.*?\*/) # comment (/\*.*?\*/) # comment
)+ )+
\s*[:\s]\s* # value is separted by colon or space \s*[:\s]\s* # value is separated by colon or space
(?!(\s*\{)) # if there are only spaces afterwards (?!(\s*\{)) # if there are only spaces afterwards

View File

@@ -222,7 +222,7 @@ man 2 select
`bat`은 [Ubuntu](https://packages.ubuntu.com/eoan/bat)와 `bat`은 [Ubuntu](https://packages.ubuntu.com/eoan/bat)와
[Debian](https://packages.debian.org/sid/bat) 패키지 배포 과정에 도입되는 중이며, [Debian](https://packages.debian.org/sid/bat) 패키지 배포 과정에 도입되는 중이며,
Eoan 19.10 버전의 Ubuntu에서부터 제공됩니다. Eoan 19.10 버전의 Ubuntu에서부터 제공됩니다.
현재 Debain에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다. 현재 Debian에서는 불안정한 "Sid" 브랜치에서만 `bat`이 제공됩니다.
만약 충분히 최신 버전의 Ubuntu/Debian이 설치되어 있다면 간단히 다음을 실행하세요: 만약 충분히 최신 버전의 Ubuntu/Debian이 설치되어 있다면 간단히 다음을 실행하세요:

12
doc/sponsors.md Normal file
View File

@@ -0,0 +1,12 @@
## Sponsors
Please note, that being sponsored does not affect the individuality of the `bat`
project or affect the maintainers' actions in any way.
We remain impartial and continue to assess pull requests solely on merit - the
features added, bugs solved, and effect on the overall complexity of the code.
No issue will have a different priority based on sponsorship status of the
reporter.
Contributions from anybody are most welcomed, please see our [`CONTRIBUTING.md`](../CONTRIBUTING.md) guide.
If you want to see our biggest sponsors, check the top of [`README.md`](../README.md#sponsors).

View File

@@ -0,0 +1,11 @@
<svg width="1354" height="420" viewBox="0 0 1354 420" fill="none" xmlns="http://www.w3.org/2000/svg">
<rect width="1354" height="420" rx="20" fill="white"/>
<path d="M434.751 133.122H466.637L489.595 227.729C493.852 245.585 494.697 256.219 494.697 256.219H495.128C495.128 256.219 496.61 245.808 500.867 227.729L522.757 133.122H558.9L582.066 227.729C586.53 246.223 587.598 256.219 587.598 256.219H588.236C588.236 256.219 588.666 246.223 592.907 227.729L615.02 133.122H646.907L606.523 288.313H571.017L546.576 194.344C541.474 173.936 541.044 164.801 541.044 164.801H540.614C540.614 164.801 540.183 173.936 535.512 194.344L512.553 288.313H475.996L434.751 133.122Z" fill="black"/>
<path d="M641.583 231.934C641.583 196.428 664.541 173.47 699.202 173.47C733.639 173.47 756.597 196.428 756.597 231.934C756.597 267.647 733.639 290.828 699.202 290.828C664.557 290.812 641.583 267.647 641.583 231.934ZM726.832 231.934C726.832 208.976 715.783 195.998 699.202 195.998C681.346 195.998 671.349 210.458 671.349 231.934C671.349 255.323 682.398 268.284 699.202 268.284C717.058 268.284 726.832 253.824 726.832 231.934Z" fill="black"/>
<path d="M770.836 175.21H799.103V196.048H799.741C804.635 185.207 816.322 174.365 836.299 174.365C839.695 174.365 841.831 174.796 843.314 175.21V203.478H842.469C842.469 203.478 839.918 202.633 832.903 202.633C811.013 202.633 799.103 215.594 799.103 239.828V288.295H770.836V175.21Z" fill="black"/>
<path d="M856.5 133.122H884.767V182.865C884.767 212.2 884.336 217.509 884.336 217.509H884.767L926.857 175.212H962.139L912.843 224.11L970.031 288.313H936.646L895.401 241.536L884.767 251.946V288.297H856.5V133.122Z" fill="black"/>
<path d="M970.444 211.285C970.444 163.455 1000.21 131.569 1044.85 131.569C1089.49 131.569 1119.26 163.455 1119.26 211.285C1119.26 259.114 1089.49 291.001 1044.85 291.001C1000.21 291.001 970.444 259.114 970.444 211.285ZM1088.42 211.285C1088.42 178.761 1071 156.855 1044.84 156.855C1018.67 156.855 1001.26 178.761 1001.26 211.285C1001.26 243.809 1018.69 265.715 1044.84 265.715C1070.98 265.715 1088.42 243.809 1088.42 211.285Z" fill="black"/>
<path d="M1130.08 236.656H1162.4C1162.4 254.943 1174.95 265.146 1194.08 265.146C1210.23 265.146 1221.29 257.063 1221.29 245.584C1221.29 232.622 1212.79 229.21 1185.79 223.901C1161.12 219.007 1134.98 210.716 1134.98 178.399C1134.98 151.408 1157.93 131 1193.01 131C1229.57 131 1252.11 150.132 1252.11 179.037H1219.79C1219.79 165.007 1208.95 156.286 1193.01 156.286C1176.86 156.286 1166.86 164.146 1166.86 175.625C1166.86 187.742 1173.88 192.413 1195.56 196.878C1227.65 203.685 1254.02 207.288 1254.02 243.001C1254.02 271.3 1229.36 290.432 1193.01 290.432C1156.02 290.432 1130.08 268.957 1130.08 236.656Z" fill="black"/>
<path d="M100 210C100 214.824 101.269 219.647 103.723 223.793L148.231 300.878C152.8 308.747 159.739 315.178 168.369 318.055C185.377 323.724 202.977 316.447 211.354 301.893L222.1 283.278L179.708 210L224.47 132.408L235.216 113.792C238.431 108.208 242.747 103.638 247.824 100H243.17H178.777C166.677 100 155.508 106.431 149.5 116.923L103.723 196.208C101.269 200.354 100 205.177 100 210Z" fill="#6363F1"/>
<path d="M353.847 210C353.847 205.177 352.578 200.353 350.124 196.207L305.024 118.107C296.647 103.638 279.047 96.3608 262.039 101.945C253.409 104.822 246.47 111.253 241.901 119.122L231.747 136.638L274.139 210L229.378 287.592L218.632 306.208C215.416 311.708 211.101 316.362 206.024 320H210.678H275.07C287.17 320 298.34 313.569 304.347 303.077L350.124 223.792C352.578 219.646 353.847 214.823 353.847 210Z" fill="#6363F1"/>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -90,7 +90,8 @@ impl HighlightingAssets {
self.fallback_theme = Some(theme); self.fallback_theme = Some(theme);
} }
fn get_syntax_set(&self) -> Result<&SyntaxSet> { /// Return the collection of syntect syntax definitions.
pub fn get_syntax_set(&self) -> Result<&SyntaxSet> {
self.syntax_set_cell self.syntax_set_cell
.get_or_try_init(|| self.serialized_syntax_set.deserialize()) .get_or_try_init(|| self.serialized_syntax_set.deserialize())
} }
@@ -186,7 +187,8 @@ impl HighlightingAssets {
} }
} }
pub(crate) fn get_theme(&self, theme: &str) -> &Theme { /// Look up a syntect theme by name.
pub fn get_theme(&self, theme: &str) -> &Theme {
match self.get_theme_set().get(theme) { match self.get_theme_set().get(theme) {
Some(theme) => theme, Some(theme) => theme,
None => { None => {

View File

@@ -104,6 +104,9 @@ fn license_not_needed_in_acknowledgements(license_text: &str) -> bool {
// Public domain // Public domain
"This is free and unencumbered software released into the public domain.", "This is free and unencumbered software released into the public domain.",
// Public domain with stronger wording than above
"DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE",
// Special license of assets/syntaxes/01_Packages/LICENSE // Special license of assets/syntaxes/01_Packages/LICENSE
"Permission to copy, use, modify, sell and distribute this software is granted. This software is provided \"as is\" without express or implied warranty, and with no claim as to its suitability for any purpose." "Permission to copy, use, modify, sell and distribute this software is granted. This software is provided \"as is\" without express or implied warranty, and with no claim as to its suitability for any purpose."
]; ];

View File

@@ -396,11 +396,19 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
.validator(|val| { .validator(|val| {
let mut invalid_vals = val.split(',').filter(|style| { let mut invalid_vals = val.split(',').filter(|style| {
!&[ !&[
"auto", "full", "plain", "header", "grid", "rule", "numbers", "snip", "auto",
"full",
"plain",
"header",
"header-filename",
"header-filesize",
"grid",
"rule",
"numbers",
"snip",
#[cfg(feature = "git")] #[cfg(feature = "git")]
"changes", "changes",
] ].contains(style)
.contains(style)
}); });
if let Some(invalid) = invalid_vals.next() { if let Some(invalid) = invalid_vals.next() {
@@ -426,7 +434,9 @@ pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
* auto: same as 'full', unless the output is piped.\n \ * auto: same as 'full', unless the output is piped.\n \
* plain: disables all available components.\n \ * plain: disables all available components.\n \
* changes: show Git modification markers.\n \ * changes: show Git modification markers.\n \
* header: show filenames before the content.\n \ * header: alias for 'header-filename'.\n \
* header-filename: show filenames before the content.\n \
* header-filesize: show file sizes before the content.\n \
* grid: vertical/horizontal lines to separate side bar\n \ * grid: vertical/horizontal lines to separate side bar\n \
and the header from the content.\n \ and the header from the content.\n \
* rule: horizontal lines to delimit files.\n \ * rule: horizontal lines to delimit files.\n \

View File

@@ -1,4 +1,5 @@
use std::convert::TryFrom; use std::convert::TryFrom;
use std::fs;
use std::fs::File; use std::fs::File;
use std::io::{self, BufRead, BufReader, Read}; use std::io::{self, BufRead, BufReader, Read};
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
@@ -87,6 +88,7 @@ impl<'a> InputKind<'a> {
#[derive(Clone, Default)] #[derive(Clone, Default)]
pub(crate) struct InputMetadata { pub(crate) struct InputMetadata {
pub(crate) user_provided_name: Option<PathBuf>, pub(crate) user_provided_name: Option<PathBuf>,
pub(crate) size: Option<u64>,
} }
pub struct Input<'a> { pub struct Input<'a> {
@@ -130,9 +132,14 @@ impl<'a> Input<'a> {
fn _ordinary_file(path: &Path) -> Self { fn _ordinary_file(path: &Path) -> Self {
let kind = InputKind::OrdinaryFile(path.to_path_buf()); let kind = InputKind::OrdinaryFile(path.to_path_buf());
let metadata = InputMetadata {
size: fs::metadata(path).map(|m| m.len()).ok(),
..InputMetadata::default()
};
Input { Input {
description: kind.description(), description: kind.description(),
metadata: InputMetadata::default(), metadata,
kind, kind,
} }
} }

View File

@@ -4,6 +4,8 @@ use std::vec::Vec;
use ansi_term::Colour::{Fixed, Green, Red, Yellow}; use ansi_term::Colour::{Fixed, Green, Red, Yellow};
use ansi_term::Style; use ansi_term::Style;
use bytesize::ByteSize;
use console::AnsiCodeIterator; use console::AnsiCodeIterator;
use syntect::easy::HighlightLines; use syntect::easy::HighlightLines;
@@ -29,6 +31,7 @@ use crate::error::*;
use crate::input::OpenedInput; use crate::input::OpenedInput;
use crate::line_range::RangeCheckResult; use crate::line_range::RangeCheckResult;
use crate::preprocessor::{expand_tabs, replace_nonprintable}; use crate::preprocessor::{expand_tabs, replace_nonprintable};
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; use crate::vscreen::AnsiStyle;
use crate::wrapping::WrappingMode; use crate::wrapping::WrappingMode;
@@ -250,6 +253,21 @@ impl<'a> InteractivePrinter<'a> {
} }
} }
fn print_header_component_indent(&mut self, handle: &mut dyn Write) -> std::io::Result<()> {
if self.config.style_components.grid() {
write!(
handle,
"{}{}",
" ".repeat(self.panel_width),
self.colors
.grid
.paint(if self.panel_width > 0 { "" } else { "" }),
)
} else {
write!(handle, "{}", " ".repeat(self.panel_width))
}
}
fn preprocess(&self, text: &str, cursor: &mut usize) -> String { fn preprocess(&self, text: &str, cursor: &mut usize) -> String {
if self.config.tab_width > 0 { if self.config.tab_width > 0 {
return expand_tabs(text, self.config.tab_width, cursor); return expand_tabs(text, self.config.tab_width, cursor);
@@ -287,25 +305,6 @@ impl<'a> Printer for InteractivePrinter<'a> {
return Ok(()); return Ok(());
} }
if self.config.style_components.grid() {
self.print_horizontal_line(handle, '┬')?;
write!(
handle,
"{}{}",
" ".repeat(self.panel_width),
self.colors
.grid
.paint(if self.panel_width > 0 { "" } else { "" }),
)?;
} else {
// Only pad space between files, if we haven't already drawn a horizontal rule
if add_header_padding && !self.config.style_components.rule() {
writeln!(handle)?;
}
write!(handle, "{}", " ".repeat(self.panel_width))?;
}
let mode = match self.content_type { let mode = match self.content_type {
Some(ContentType::BINARY) => " <BINARY>", Some(ContentType::BINARY) => " <BINARY>",
Some(ContentType::UTF_16LE) => " <UTF-16LE>", Some(ContentType::UTF_16LE) => " <UTF-16LE>",
@@ -315,17 +314,60 @@ impl<'a> Printer for InteractivePrinter<'a> {
}; };
let description = &input.description; let description = &input.description;
let metadata = &input.metadata;
writeln!( // We use this iterator to have a deterministic order for
// header components. HashSet has arbitrary order, but Vec is ordered.
let header_components: Vec<StyleComponent> = [
(
StyleComponent::HeaderFilename,
self.config.style_components.header_filename(),
),
(
StyleComponent::HeaderFilesize,
self.config.style_components.header_filesize(),
),
]
.iter()
.filter(|(_, is_enabled)| *is_enabled)
.map(|(component, _)| *component)
.collect();
// Print the cornering grid before the first header component
if self.config.style_components.grid() {
self.print_horizontal_line(handle, '┬')?;
} else {
// Only pad space between files, if we haven't already drawn a horizontal rule
if add_header_padding && !self.config.style_components.rule() {
writeln!(handle)?;
}
}
header_components.iter().try_for_each(|component| {
self.print_header_component_indent(handle)?;
match component {
StyleComponent::HeaderFilename => writeln!(
handle, handle,
"{}{}{}", "{}{}{}",
description description
.kind() .kind()
.map(|kind| format!("{}: ", kind)) .map(|kind| format!("{}: ", kind))
.unwrap_or_else(|| "".into()), .unwrap_or_else(|| "".into()),
self.colors.filename.paint(description.title()), self.colors.header_value.paint(description.title()),
mode mode
)?; ),
StyleComponent::HeaderFilesize => {
let bsize = metadata
.size
.map(|s| format!("{}", ByteSize(s)))
.unwrap_or_else(|| "-".into());
writeln!(handle, "Size: {}", self.colors.header_value.paint(bsize))
}
_ => Ok(()),
}
})?;
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 {
@@ -617,7 +659,7 @@ const DEFAULT_GUTTER_COLOR: u8 = 238;
pub struct Colors { pub struct Colors {
pub grid: Style, pub grid: Style,
pub rule: Style, pub rule: Style,
pub filename: Style, pub header_value: Style,
pub git_added: Style, pub git_added: Style,
pub git_removed: Style, pub git_removed: Style,
pub git_modified: Style, pub git_modified: Style,
@@ -646,7 +688,7 @@ impl Colors {
Colors { Colors {
grid: gutter_style, grid: gutter_style,
rule: gutter_style, rule: gutter_style,
filename: Style::new().bold(), header_value: Style::new().bold(),
git_added: Green.normal(), git_added: Green.normal(),
git_removed: Red.normal(), git_removed: Red.normal(),
git_modified: Yellow.normal(), git_modified: Yellow.normal(),

View File

@@ -3,6 +3,7 @@ use std::str::FromStr;
use crate::error::*; use crate::error::*;
#[non_exhaustive]
#[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)] #[derive(Debug, Eq, PartialEq, Copy, Clone, Hash)]
pub enum StyleComponent { pub enum StyleComponent {
Auto, Auto,
@@ -11,6 +12,8 @@ pub enum StyleComponent {
Grid, Grid,
Rule, Rule,
Header, Header,
HeaderFilename,
HeaderFilesize,
LineNumbers, LineNumbers,
Snip, Snip,
Full, Full,
@@ -31,14 +34,17 @@ impl StyleComponent {
StyleComponent::Changes => &[StyleComponent::Changes], StyleComponent::Changes => &[StyleComponent::Changes],
StyleComponent::Grid => &[StyleComponent::Grid], StyleComponent::Grid => &[StyleComponent::Grid],
StyleComponent::Rule => &[StyleComponent::Rule], StyleComponent::Rule => &[StyleComponent::Rule],
StyleComponent::Header => &[StyleComponent::Header], StyleComponent::Header => &[StyleComponent::HeaderFilename],
StyleComponent::HeaderFilename => &[StyleComponent::HeaderFilename],
StyleComponent::HeaderFilesize => &[StyleComponent::HeaderFilesize],
StyleComponent::LineNumbers => &[StyleComponent::LineNumbers], StyleComponent::LineNumbers => &[StyleComponent::LineNumbers],
StyleComponent::Snip => &[StyleComponent::Snip], StyleComponent::Snip => &[StyleComponent::Snip],
StyleComponent::Full => &[ StyleComponent::Full => &[
#[cfg(feature = "git")] #[cfg(feature = "git")]
StyleComponent::Changes, StyleComponent::Changes,
StyleComponent::Grid, StyleComponent::Grid,
StyleComponent::Header, StyleComponent::HeaderFilename,
StyleComponent::HeaderFilesize,
StyleComponent::LineNumbers, StyleComponent::LineNumbers,
StyleComponent::Snip, StyleComponent::Snip,
], ],
@@ -58,6 +64,8 @@ impl FromStr for StyleComponent {
"grid" => Ok(StyleComponent::Grid), "grid" => Ok(StyleComponent::Grid),
"rule" => Ok(StyleComponent::Rule), "rule" => Ok(StyleComponent::Rule),
"header" => Ok(StyleComponent::Header), "header" => Ok(StyleComponent::Header),
"header-filename" => Ok(StyleComponent::HeaderFilename),
"header-filesize" => Ok(StyleComponent::HeaderFilesize),
"numbers" => Ok(StyleComponent::LineNumbers), "numbers" => Ok(StyleComponent::LineNumbers),
"snip" => Ok(StyleComponent::Snip), "snip" => Ok(StyleComponent::Snip),
"full" => Ok(StyleComponent::Full), "full" => Ok(StyleComponent::Full),
@@ -89,7 +97,15 @@ impl StyleComponents {
} }
pub fn header(&self) -> bool { pub fn header(&self) -> bool {
self.0.contains(&StyleComponent::Header) self.header_filename() || self.header_filesize()
}
pub fn header_filename(&self) -> bool {
self.0.contains(&StyleComponent::HeaderFilename)
}
pub fn header_filesize(&self) -> bool {
self.0.contains(&StyleComponent::HeaderFilesize)
} }
pub fn numbers(&self) -> bool { pub fn numbers(&self) -> bool {

View File

@@ -0,0 +1 @@
I am small file 0

View File

@@ -0,0 +1 @@
I am small file 1

View File

@@ -0,0 +1 @@
I am small file 10

View File

@@ -0,0 +1 @@
I am small file 100

View File

@@ -0,0 +1 @@
I am small file 11

View File

@@ -0,0 +1 @@
I am small file 12

View File

@@ -0,0 +1 @@
I am small file 13

View File

@@ -0,0 +1 @@
I am small file 14

View File

@@ -0,0 +1 @@
I am small file 15

View File

@@ -0,0 +1 @@
I am small file 16

View File

@@ -0,0 +1 @@
I am small file 17

View File

@@ -0,0 +1 @@
I am small file 18

View File

@@ -0,0 +1 @@
I am small file 19

View File

@@ -0,0 +1 @@
I am small file 2

View File

@@ -0,0 +1 @@
I am small file 20

View File

@@ -0,0 +1 @@
I am small file 21

View File

@@ -0,0 +1 @@
I am small file 22

View File

@@ -0,0 +1 @@
I am small file 23

View File

@@ -0,0 +1 @@
I am small file 24

View File

@@ -0,0 +1 @@
I am small file 25

View File

@@ -0,0 +1 @@
I am small file 26

View File

@@ -0,0 +1 @@
I am small file 27

View File

@@ -0,0 +1 @@
I am small file 28

View File

@@ -0,0 +1 @@
I am small file 29

View File

@@ -0,0 +1 @@
I am small file 3

View File

@@ -0,0 +1 @@
I am small file 30

View File

@@ -0,0 +1 @@
I am small file 31

View File

@@ -0,0 +1 @@
I am small file 32

View File

@@ -0,0 +1 @@
I am small file 33

View File

@@ -0,0 +1 @@
I am small file 34

View File

@@ -0,0 +1 @@
I am small file 35

View File

@@ -0,0 +1 @@
I am small file 36

View File

@@ -0,0 +1 @@
I am small file 37

View File

@@ -0,0 +1 @@
I am small file 38

View File

@@ -0,0 +1 @@
I am small file 39

View File

@@ -0,0 +1 @@
I am small file 4

View File

@@ -0,0 +1 @@
I am small file 40

View File

@@ -0,0 +1 @@
I am small file 41

View File

@@ -0,0 +1 @@
I am small file 42

View File

@@ -0,0 +1 @@
I am small file 43

View File

@@ -0,0 +1 @@
I am small file 44

View File

@@ -0,0 +1 @@
I am small file 45

View File

@@ -0,0 +1 @@
I am small file 46

View File

@@ -0,0 +1 @@
I am small file 47

View File

@@ -0,0 +1 @@
I am small file 48

View File

@@ -0,0 +1 @@
I am small file 49

View File

@@ -0,0 +1 @@
I am small file 5

View File

@@ -0,0 +1 @@
I am small file 50

View File

@@ -0,0 +1 @@
I am small file 51

View File

@@ -0,0 +1 @@
I am small file 52

View File

@@ -0,0 +1 @@
I am small file 53

View File

@@ -0,0 +1 @@
I am small file 54

View File

@@ -0,0 +1 @@
I am small file 55

View File

@@ -0,0 +1 @@
I am small file 56

View File

@@ -0,0 +1 @@
I am small file 57

View File

@@ -0,0 +1 @@
I am small file 58

View File

@@ -0,0 +1 @@
I am small file 59

View File

@@ -0,0 +1 @@
I am small file 6

View File

@@ -0,0 +1 @@
I am small file 60

View File

@@ -0,0 +1 @@
I am small file 61

View File

@@ -0,0 +1 @@
I am small file 62

View File

@@ -0,0 +1 @@
I am small file 63

View File

@@ -0,0 +1 @@
I am small file 64

View File

@@ -0,0 +1 @@
I am small file 65

View File

@@ -0,0 +1 @@
I am small file 66

View File

@@ -0,0 +1 @@
I am small file 67

View File

@@ -0,0 +1 @@
I am small file 68

View File

@@ -0,0 +1 @@
I am small file 69

View File

@@ -0,0 +1 @@
I am small file 7

View File

@@ -0,0 +1 @@
I am small file 70

View File

@@ -0,0 +1 @@
I am small file 71

View File

@@ -0,0 +1 @@
I am small file 72

View File

@@ -0,0 +1 @@
I am small file 73

View File

@@ -0,0 +1 @@
I am small file 74

View File

@@ -0,0 +1 @@
I am small file 75

View File

@@ -0,0 +1 @@
I am small file 76

View File

@@ -0,0 +1 @@
I am small file 77

View File

@@ -0,0 +1 @@
I am small file 78

View File

@@ -0,0 +1 @@
I am small file 79

View File

@@ -0,0 +1 @@
I am small file 8

View File

@@ -0,0 +1 @@
I am small file 80

View File

@@ -0,0 +1 @@
I am small file 81

Some files were not shown because too many files have changed in this diff Show More