mirror of
https://github.com/sharkdp/bat
synced 2026-08-04 19:01:44 +00:00
Compare commits
166 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 30b742e984 | |||
| 671deeef8c | |||
| a892caeb33 | |||
| a770cbf25e | |||
| 931c6e9414 | |||
| 8dc7e2efa3 | |||
| 10965a6122 | |||
| e43d97dc15 | |||
| 2c7087b8de | |||
| bb1f5aa841 | |||
| 2109a7830b | |||
| ec27c78a8a | |||
| 67fe833bc8 | |||
| e956225b4d | |||
| 314ec881ef | |||
| 25a6a55437 | |||
| 5bff4548be | |||
| 866b9e16a8 | |||
| 5af176c94f | |||
| 9e7da05459 | |||
| 1ae02c65fb | |||
| 495e7fd3b1 | |||
| b48f0fe389 | |||
| c19c704a43 | |||
| 693bd5929d | |||
| 8275b0436d | |||
| 278bde5cee | |||
| eee7e5a575 | |||
| ad7b634ee6 | |||
| 1310f83c8d | |||
| 897b9e7030 | |||
| 1891e194b5 | |||
| d2d01b9fe8 | |||
| 5842d58c01 | |||
| e3c71adba7 | |||
| 504f28b3a1 | |||
| d977ba9194 | |||
| 9c09799e1f | |||
| d83c93c805 | |||
| fc8fd1e63f | |||
| 404d6a4a81 | |||
| 25d96da4a2 | |||
| e97095b724 | |||
| ce96df00b6 | |||
| f98fc5f06a | |||
| 1dbb4ef683 | |||
| 0502a3bd4a | |||
| 869cf6368c | |||
| 078228deac | |||
| e09d7dabb8 | |||
| 6d1cc8c2c8 | |||
| 87f021078e | |||
| d5b0502419 | |||
| 860f3e9006 | |||
| 1be346a038 | |||
| f9fd5e4851 | |||
| da09f3877b | |||
| e30e1bab2e | |||
| f140f6da46 | |||
| 3446fdf5f2 | |||
| e1345cdc2a | |||
| a2676ccc55 | |||
| b39e28d2c8 | |||
| 0d71968615 | |||
| 80da0dc619 | |||
| 64903bb858 | |||
| 3456ce1187 | |||
| 886a5b3d24 | |||
| 238482e5f3 | |||
| 79b960e17e | |||
| 6aa626f1c4 | |||
| 1b30539493 | |||
| 96b24d8a7e | |||
| 20b02e72b3 | |||
| 254efac9c2 | |||
| dcec322117 | |||
| d781156327 | |||
| 732750c274 | |||
| 6b6baa3118 | |||
| 54c434934e | |||
| ad6e0a2581 | |||
| bd619db3ca | |||
| e098eb43a2 | |||
| ea369ee17f | |||
| 63d32bc818 | |||
| dccf8d8221 | |||
| 97129ab9d8 | |||
| 52d0d6ca30 | |||
| a05494e9d9 | |||
| 84ac92efbb | |||
| b4c6e412dc | |||
| 3e21d69a92 | |||
| b7690d4bb1 | |||
| d404139ff7 | |||
| 9ef1e9f792 | |||
| 503fe0b641 | |||
| 1807f9653c | |||
| 1e74f0e2a9 | |||
| c1e1f753cf | |||
| d90797f8e9 | |||
| b4096e5627 | |||
| 4e3ab4d399 | |||
| f0d936763c | |||
| 7897260bf0 | |||
| eb6e43b9a9 | |||
| 7cdcdbb31d | |||
| 9159341714 | |||
| b23ff24ebc | |||
| e1ecc17f69 | |||
| 0fe3badf19 | |||
| 89d4cb951a | |||
| e9681bf22d | |||
| 1b6df8a480 | |||
| cf24986edb | |||
| b9c556a0b6 | |||
| 9d6bde48fa | |||
| d6c8fee044 | |||
| 8b4abb03db | |||
| 375cf76e15 | |||
| 1a4acc435e | |||
| d8030626f8 | |||
| fb61aa4f60 | |||
| 76df41fa97 | |||
| 97efd75cee | |||
| 53d0c1deca | |||
| 155179a07a | |||
| ba00caf9c3 | |||
| ac418ba21c | |||
| acde83af31 | |||
| 021a68eb21 | |||
| 566aab3b05 | |||
| f88eba6476 | |||
| 1d9e7ac4c2 | |||
| 80ae2ecbf8 | |||
| 96d4492d27 | |||
| c90f0b8e21 | |||
| 4b866ab6af | |||
| 2dbd91e543 | |||
| 785da3d9df | |||
| d455cb7c32 | |||
| d2b4766f92 | |||
| 5cf92b4f94 | |||
| 7b803a50af | |||
| 67ec5fe2b7 | |||
| 3447ed4def | |||
| 532fb921a6 | |||
| ba4d5a2e7d | |||
| 026273a05c | |||
| 8903b64830 | |||
| 194155f062 | |||
| a6ff3b900d | |||
| 8a52bcf92d | |||
| 0b1535f63b | |||
| 0a5b3eaf3e | |||
| 11294249f8 | |||
| 35a1236ad0 | |||
| af8da50c2c | |||
| 649d1e3df2 | |||
| 199cfd4519 | |||
| c7cce0752b | |||
| 3a89486189 | |||
| 720a2fb7a5 | |||
| e3c990f11e | |||
| 90c7d0c365 | |||
| 56002267d2 | |||
| 84734eac9d |
+33
@@ -61,3 +61,36 @@
|
|||||||
[submodule "assets/syntaxes/Puppet"]
|
[submodule "assets/syntaxes/Puppet"]
|
||||||
path = assets/syntaxes/Puppet
|
path = assets/syntaxes/Puppet
|
||||||
url = https://github.com/russCloak/SublimePuppet
|
url = https://github.com/russCloak/SublimePuppet
|
||||||
|
[submodule "assets/syntaxes/CSV"]
|
||||||
|
path = assets/syntaxes/CSV
|
||||||
|
url = https://github.com/wadetb/Sublime-Text-Advanced-CSV
|
||||||
|
[submodule "assets/themes/onehalf"]
|
||||||
|
path = assets/themes/onehalf
|
||||||
|
url = https://github.com/sonph/onehalf
|
||||||
|
[submodule "assets/syntaxes/JavaScript (Babel)"]
|
||||||
|
path = assets/syntaxes/JavaScript (Babel)
|
||||||
|
url = https://github.com/babel/babel-sublime
|
||||||
|
[submodule "assets/syntaxes/Cabal"]
|
||||||
|
path = assets/syntaxes/Cabal
|
||||||
|
url = https://github.com/SublimeHaskell/SublimeHaskell
|
||||||
|
[submodule "assets/syntaxes/Dart"]
|
||||||
|
path = assets/syntaxes/Dart
|
||||||
|
url = https://github.com/guillermooo/dart-sublime-bundle
|
||||||
|
[submodule "assets/syntaxes/FSharp"]
|
||||||
|
path = assets/syntaxes/FSharp
|
||||||
|
url = https://github.com/hoest/sublimetext-fsharp
|
||||||
|
[submodule "assets/syntaxes/PureScript"]
|
||||||
|
path = assets/syntaxes/PureScript
|
||||||
|
url = https://github.com/tellnobody1/sublime-purescript-syntax
|
||||||
|
[submodule "assets/syntaxes/Swift"]
|
||||||
|
path = assets/syntaxes/Swift
|
||||||
|
url = https://github.com/quiqueg/Swift-Sublime-Package
|
||||||
|
[submodule "assets/syntaxes/Crystal"]
|
||||||
|
path = assets/syntaxes/Crystal
|
||||||
|
url = https://github.com/crystal-lang-tools/sublime-crystal.git
|
||||||
|
[submodule "assets/syntaxes/PowerShell"]
|
||||||
|
path = assets/syntaxes/PowerShell
|
||||||
|
url = https://github.com/PowerShell/EditorSyntax
|
||||||
|
[submodule "assets/syntaxes/Robot"]
|
||||||
|
path = assets/syntaxes/Robot
|
||||||
|
url = https://github.com/andriyko/sublime-robot-framework-assistant.git
|
||||||
|
|||||||
+9
-3
@@ -23,18 +23,24 @@ matrix:
|
|||||||
- TARGET=arm-unknown-linux-gnueabihf
|
- TARGET=arm-unknown-linux-gnueabihf
|
||||||
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
|
- CC_arm_unknown_linux_gnueabihf=/usr/bin/arm-linux-gnueabihf-gcc-4.8
|
||||||
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
- CARGO_TARGET_ARM_UNKNOWN_LINUX_GNUEABIHF_LINKER=arm-linux-gnueabihf-gcc-4.8
|
||||||
|
- os: linux
|
||||||
|
rust: stable
|
||||||
|
env:
|
||||||
|
- TARGET=aarch64-unknown-linux-gnu
|
||||||
|
- CC_aarch64-unknown-linux-gnu=/usr/bin/aarch64-linux-gnu-gcc-4.8
|
||||||
|
- CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc-4.8
|
||||||
|
|
||||||
# Minimum Rust supported channel.
|
# Minimum Rust supported channel.
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: 1.26.0
|
rust: 1.29.0
|
||||||
env: TARGET=x86_64-unknown-linux-gnu
|
env: TARGET=x86_64-unknown-linux-gnu
|
||||||
- os: linux
|
- os: linux
|
||||||
rust: 1.26.0
|
rust: 1.29.0
|
||||||
env:
|
env:
|
||||||
- TARGET=x86_64-unknown-linux-musl
|
- TARGET=x86_64-unknown-linux-musl
|
||||||
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
- CC_x86_64_unknown_linux_musl=/usr/bin/musl-gcc
|
||||||
- os: osx
|
- os: osx
|
||||||
rust: 1.26.0
|
rust: 1.29.0
|
||||||
env: TARGET=x86_64-apple-darwin
|
env: TARGET=x86_64-apple-darwin
|
||||||
|
|
||||||
# Code formatting check
|
# Code formatting check
|
||||||
|
|||||||
Generated
+370
-157
@@ -3,7 +3,15 @@ name = "aho-corasick"
|
|||||||
version = "0.6.8"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ansi_colours"
|
||||||
|
version = "1.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -11,7 +19,18 @@ name = "ansi_term"
|
|||||||
version = "0.11.0"
|
version = "0.11.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "assert_cmd"
|
||||||
|
version = "0.10.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"escargot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"predicates 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -21,32 +40,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.8.0"
|
version = "0.9.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bat"
|
name = "bat"
|
||||||
version = "0.6.0"
|
version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"assert_cmd 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"console 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"directories 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"content_inspector 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syntect 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"shell-words 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"syntect 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"wild 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -55,7 +80,7 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -70,7 +95,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.22"
|
version = "1.0.25"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -78,16 +103,6 @@ name = "cfg-if"
|
|||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chrono"
|
|
||||||
version = "0.4.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "clap"
|
name = "clap"
|
||||||
version = "2.32.0"
|
version = "2.32.0"
|
||||||
@@ -100,6 +115,7 @@ dependencies = [
|
|||||||
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -110,49 +126,129 @@ dependencies = [
|
|||||||
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cmake"
|
name = "cloudabi"
|
||||||
version = "0.1.33"
|
version = "0.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "console"
|
name = "console"
|
||||||
version = "0.6.1"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "content_inspector"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "difference"
|
||||||
|
version = "2.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "directories"
|
name = "directories"
|
||||||
version = "1.0.1"
|
version = "1.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding"
|
||||||
|
version = "0.2.33"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding-index-japanese"
|
||||||
|
version = "1.20141219.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding-index-korean"
|
||||||
|
version = "1.20141219.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding-index-simpchinese"
|
||||||
|
version = "1.20141219.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding-index-singlebyte"
|
||||||
|
version = "1.20141219.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding-index-tradchinese"
|
||||||
|
version = "1.20141219.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "encoding_index_tests"
|
||||||
|
version = "0.1.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "error-chain"
|
name = "error-chain"
|
||||||
version = "0.12.0"
|
version = "0.12.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "escargot"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "flate2"
|
name = "flate2"
|
||||||
version = "1.0.2"
|
version = "1.0.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -185,11 +281,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "glob"
|
||||||
|
version = "0.2.11"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "humantime"
|
||||||
|
version = "1.1.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "idna"
|
name = "idna"
|
||||||
version = "0.1.5"
|
version = "0.1.5"
|
||||||
@@ -202,7 +311,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "itoa"
|
name = "itoa"
|
||||||
version = "0.4.2"
|
version = "0.4.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -224,9 +333,14 @@ name = "lazy_static"
|
|||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "lazycell"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.43"
|
version = "0.2.43"
|
||||||
@@ -234,22 +348,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libgit2-sys"
|
name = "libgit2-sys"
|
||||||
version = "0.7.7"
|
version = "0.7.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libz-sys 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libz-sys 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libz-sys"
|
name = "libz-sys"
|
||||||
version = "1.0.20"
|
version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -262,7 +375,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "lock_api"
|
name = "lock_api"
|
||||||
version = "0.1.3"
|
version = "0.1.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -271,7 +384,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.4"
|
version = "0.4.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -284,10 +397,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
version = "2.0.2"
|
version = "2.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
"cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -295,40 +410,27 @@ name = "miniz-sys"
|
|||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-integer"
|
|
||||||
version = "0.1.39"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
dependencies = [
|
|
||||||
"num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-traits"
|
|
||||||
version = "0.2.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "onig"
|
name = "onig"
|
||||||
version = "3.2.2"
|
version = "4.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"onig_sys 68.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"onig_sys 69.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "onig_sys"
|
name = "onig_sys"
|
||||||
version = "68.2.0"
|
version = "69.0.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)",
|
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
@@ -343,22 +445,23 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot"
|
name = "parking_lot"
|
||||||
version = "0.6.3"
|
version = "0.6.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "parking_lot_core"
|
name = "parking_lot_core"
|
||||||
version = "0.2.14"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -373,30 +476,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "plist"
|
name = "plist"
|
||||||
version = "0.2.4"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "predicates"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "predicates-core"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "predicates-tree"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "proc-macro2"
|
name = "proc-macro2"
|
||||||
version = "0.4.14"
|
version = "0.4.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "quick-error"
|
||||||
|
version = "1.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "0.6.8"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -406,9 +537,34 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.5.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.2.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "redox_syscall"
|
name = "redox_syscall"
|
||||||
version = "0.1.40"
|
version = "0.1.40"
|
||||||
@@ -424,24 +580,19 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex"
|
name = "regex"
|
||||||
version = "0.2.11"
|
version = "1.0.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "regex-syntax"
|
name = "regex-syntax"
|
||||||
version = "0.4.2"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "regex-syntax"
|
|
||||||
version = "0.5.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -452,7 +603,15 @@ name = "remove_dir_all"
|
|||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rustc_version"
|
||||||
|
version = "0.2.3"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -462,7 +621,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "safemem"
|
name = "safemem"
|
||||||
version = "0.2.0"
|
version = "0.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -479,30 +638,51 @@ version = "0.3.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "semver"
|
||||||
version = "1.0.75"
|
version = "0.9.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "semver-parser"
|
||||||
|
version = "0.7.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde"
|
||||||
version = "1.0.75"
|
version = "1.0.79"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "serde_derive"
|
||||||
|
version = "1.0.79"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"syn 0.15.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_json"
|
name = "serde_json"
|
||||||
version = "1.0.26"
|
version = "1.0.32"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"itoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shell-words"
|
||||||
|
version = "0.1.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "smallvec"
|
name = "smallvec"
|
||||||
version = "0.6.5"
|
version = "0.6.5"
|
||||||
@@ -523,32 +703,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "0.14.9"
|
version = "0.15.9"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)",
|
"proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syntect"
|
name = "syntect"
|
||||||
version = "2.1.0"
|
version = "3.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
"fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"onig 3.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"plist 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
"onig 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
"plist 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
|
"regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)",
|
"serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -582,7 +763,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "termios"
|
name = "termios"
|
||||||
version = "0.2.2"
|
version = "0.3.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -606,14 +787,9 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "time"
|
name = "treeline"
|
||||||
version = "0.1.40"
|
version = "0.1.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
|
||||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ucd-util"
|
name = "ucd-util"
|
||||||
@@ -671,9 +847,14 @@ name = "vcpkg"
|
|||||||
version = "0.2.6"
|
version = "0.2.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "vec_map"
|
||||||
|
version = "0.8.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "version_check"
|
name = "version_check"
|
||||||
version = "0.1.4"
|
version = "0.1.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -687,10 +868,18 @@ version = "2.2.5"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wild"
|
||||||
|
version = "2.0.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
dependencies = [
|
||||||
|
"glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
@@ -698,7 +887,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.3.5"
|
version = "0.3.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -720,7 +909,7 @@ name = "winapi-util"
|
|||||||
version = "0.1.1"
|
version = "0.1.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
"winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -738,7 +927,7 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "yaml-rust"
|
name = "yaml-rust"
|
||||||
version = "0.4.0"
|
version = "0.4.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
"linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
@@ -746,78 +935,100 @@ dependencies = [
|
|||||||
|
|
||||||
[metadata]
|
[metadata]
|
||||||
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
|
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
|
||||||
|
"checksum ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0f302a81afc6a7f4350c04f0ba7cfab529cc009bca3324b3fb5764e6add8b6"
|
||||||
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
"checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b"
|
||||||
|
"checksum assert_cmd 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d5db841dcfb4f172f34ec968f71c4a88e69f5421fb33e0daac6bfe4372317526"
|
||||||
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
"checksum atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9a7d5b8723950951411ee34d271d99dddcc2035a16ab25310ea2c8cfd4369652"
|
||||||
"checksum base64 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7c4a342b450b268e1be8036311e2c613d7f8a7ed31214dff1cc3b60852a3168d"
|
"checksum base64 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643"
|
||||||
"checksum bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f2fb9e29e72fd6bc12071533d5dc7664cb01480c59406f656d7ac25c7bd8ff7"
|
"checksum bincode 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9f2fb9e29e72fd6bc12071533d5dc7664cb01480c59406f656d7ac25c7bd8ff7"
|
||||||
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
"checksum bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "228047a76f468627ca71776ecdebd732a3423081fcf5125585bcd7c49886ce12"
|
||||||
"checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781"
|
"checksum byteorder 1.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "90492c5858dd7d2e78691cfb89f90d273a2800fc11d98f60786e5d87e2f83781"
|
||||||
"checksum cc 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = "4a6007c146fdd28d4512a794b07ffe9d8e89e6bf86e2e0c4ddff2e1fb54a0007"
|
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16"
|
||||||
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
|
"checksum cfg-if 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0c4e7bb64a8ebb0d856483e1e682ea3422f883c5f5615a90d51a2c82fe87fdd3"
|
||||||
"checksum chrono 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "45912881121cb26fad7c38c17ba7daa18764771836b34fab7d3fbd93ed633878"
|
|
||||||
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
"checksum clap 2.32.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b957d88f4b6a63b9d70d5f454ac8011819c6efa7727858f458ab71c756ce2d3e"
|
||||||
"checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"
|
"checksum clicolors-control 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1f84dec9bc083ce2503908cd305af98bd363da6f54bf8d4bf0ac14ee749ad5d1"
|
||||||
"checksum cmake 0.1.33 (registry+https://github.com/rust-lang/crates.io-index)" = "704fbf3bb5149daab0afb255dbea24a1f08d2f4099cedb9baab6d470d4c5eefb"
|
"checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
|
||||||
"checksum console 0.6.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7649ca90478264b9686aac8d269fcb014f14c2bed7c79a7e51b9f6afd4d783eb"
|
"checksum console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6"
|
||||||
"checksum directories 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b106a38a9bf6c763c6c2e2c3332ab7635da453a68a6babca776386b3b287d338"
|
"checksum content_inspector 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "f15b971ded7c58a746a1c7441c358800337e08f869f75ddd825672984563fafc"
|
||||||
|
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
|
||||||
|
"checksum directories 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "72d337a64190607d4fcca2cb78982c5dd57f4916e19696b48a575fa746b6cb0f"
|
||||||
|
"checksum encoding 0.2.33 (registry+https://github.com/rust-lang/crates.io-index)" = "6b0d943856b990d12d3b55b359144ff341533e516d94098b1d3fc1ac666d36ec"
|
||||||
|
"checksum encoding-index-japanese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "04e8b2ff42e9a05335dbf8b5c6f7567e5591d0d916ccef4e0b1710d32a0d0c91"
|
||||||
|
"checksum encoding-index-korean 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4dc33fb8e6bcba213fe2f14275f0963fd16f0a02c878e3095ecfdf5bee529d81"
|
||||||
|
"checksum encoding-index-simpchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d87a7194909b9118fc707194baa434a4e3b0fb6a5a757c73c3adb07aa25031f7"
|
||||||
|
"checksum encoding-index-singlebyte 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "3351d5acffb224af9ca265f435b859c7c01537c0849754d3db3fdf2bfe2ae84a"
|
||||||
|
"checksum encoding-index-tradchinese 1.20141219.5 (registry+https://github.com/rust-lang/crates.io-index)" = "fd0e20d5688ce3cab59eb3ef3a2083a5c77bf496cb798dc6fcdb75f323890c18"
|
||||||
|
"checksum encoding_index_tests 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "a246d82be1c9d791c5dfde9a2bd045fc3cbba3fa2b11ad558f27d01712f00569"
|
||||||
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
"checksum error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "07e791d3be96241c77c43846b665ef1384606da2cd2a48730abe606a12906e02"
|
||||||
"checksum flate2 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "37847f133aae7acf82bb9577ccd8bda241df836787642654286e79679826a54b"
|
"checksum escargot 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "19db1f7e74438642a5018cdf263bb1325b2e792f02dd0a3ca6d6c0f0d7b1d5a5"
|
||||||
|
"checksum flate2 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "4af030962d89d62aa52cd9492083b1cd9b2d1a77764878102a6c0f86b4d5444d"
|
||||||
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
"checksum fnv 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "2fad85553e09a6f881f739c29f0b00b0f01357c743266d478b68951ce23285f3"
|
||||||
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
"checksum fuchsia-zircon 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82"
|
||||||
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
"checksum fuchsia-zircon-sys 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||||
"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71"
|
"checksum git2 0.7.5 (registry+https://github.com/rust-lang/crates.io-index)" = "591f8be1674b421644b6c030969520bc3fa12114d2eb467471982ed3e9584e71"
|
||||||
|
"checksum glob 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "8be18de09a56b60ed0edf84bc9df007e30040691af7acd1c41874faac5895bfb"
|
||||||
|
"checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
|
||||||
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
"checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e"
|
||||||
"checksum itoa 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5adb58558dcd1d786b5f0bd15f3226ee23486e24b7b58304b60f64dc68e62606"
|
"checksum itoa 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b"
|
||||||
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
|
||||||
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
"checksum lazy_static 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "76f033c7ad61445c5b347c7382dd1237847eb1bce590fe50365dcb33d546be73"
|
||||||
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
|
"checksum lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ca488b89a5657b0a2ecd45b95609b3e848cf1755da332a0da46e2b2b1cb371a7"
|
||||||
|
"checksum lazycell 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ddba4c30a78328befecec92fc94970e53b3ae385827d28620f0f5bb2493081e0"
|
||||||
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
|
"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d"
|
||||||
"checksum libgit2-sys 0.7.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6ab62b46003ba97701554631fa570d9f7e7947e2480ae3d941e555a54a2c0f05"
|
"checksum libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4916b5addc78ec36cc309acfcdf0b9f9d97ab7b84083118b248709c5b7029356"
|
||||||
"checksum libz-sys 1.0.20 (registry+https://github.com/rust-lang/crates.io-index)" = "f5f9aba969b3c45fe9c94bec65895868a9ceca9a600699f4054b75747a19c7c6"
|
"checksum libz-sys 1.0.23 (registry+https://github.com/rust-lang/crates.io-index)" = "c7bdca442aa002a930e6eb2a71916cabe46d91ffec8df66db0abfb1bc83469ab"
|
||||||
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
|
"checksum linked-hash-map 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "70fb39025bc7cdd76305867c4eccf2f2dcf6e9a57f5b21a93e1c2d86cd03ec9e"
|
||||||
"checksum lock_api 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "949826a5ccf18c1b3a7c3d57692778d21768b79e46eb9dd07bfc4c2160036c54"
|
"checksum lock_api 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "775751a3e69bde4df9b38dd00a1b5d6ac13791e4223d4a0506577f0dd27cfb7a"
|
||||||
"checksum log 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "cba860f648db8e6f269df990180c2217f333472b4a6e901e97446858487971e2"
|
"checksum log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f"
|
||||||
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
"checksum matches 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
||||||
"checksum memchr 2.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a3b4142ab8738a78c51896f704f83c11df047ff1bda9a92a661aa6361552d93d"
|
"checksum memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b"
|
||||||
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
|
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4"
|
||||||
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea"
|
"checksum onig 4.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9f0d9dac9b8a5211103d75f3ce8d0c799e6f4f3f22608eeaefb4419786e4b258"
|
||||||
"checksum num-traits 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "630de1ef5cc79d0cdd78b7e33b81f083cbfe90de0f4b2b2f07f905867c70e9fe"
|
"checksum onig_sys 69.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "78c04019a39ebac42dfd8c7822af0a009043720845a812ddbb95e403298b0183"
|
||||||
"checksum onig 3.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f5eeb268a4620c74ea5768c6d2ccd492d60a47a8754666b91a46bfc35cd4d1ba"
|
|
||||||
"checksum onig_sys 68.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "48b1fc88a091cf46a8ec67a3cd3ffd55f75d3bed741c76f253d78746ec43602b"
|
|
||||||
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
"checksum owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "cdf84f41639e037b484f93433aa3897863b561ed65c6e59c7073d7c561710f37"
|
||||||
"checksum parking_lot 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69376b761943787ebd5cc85a5bc95958651a22609c5c1c2b65de21786baec72b"
|
"checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
|
||||||
"checksum parking_lot_core 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "4db1a8ccf734a7bce794cc19b3df06ed87ab2f3907036b693c68f56b4d4537fa"
|
"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c"
|
||||||
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
"checksum percent-encoding 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831"
|
||||||
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
|
"checksum pkg-config 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "676e8eb2b1b4c9043511a9b7bea0915320d7e502b0a079fb03f9635a5252b18c"
|
||||||
"checksum plist 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c61ac2afed2856590ae79d6f358a24b85ece246d2aa134741a66d589519b7503"
|
"checksum plist 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0c7316832d9ac5da02786bdc89a3faf0ca07070212b388766e969078fd593edc"
|
||||||
"checksum proc-macro2 0.4.14 (registry+https://github.com/rust-lang/crates.io-index)" = "b331c6ad3411474cd55540398dc7ad89fc41488e64ec71fdecc9c9b86de96fb0"
|
"checksum predicates 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa984b7cd021a0bf5315bcce4c4ae61d2a535db2a8d288fc7578638690a7b7c3"
|
||||||
|
"checksum predicates-core 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "06075c3a3e92559ff8929e7a280684489ea27fe44805174c3ebd9328dcb37178"
|
||||||
|
"checksum predicates-tree 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8e63c4859013b38a76eca2414c64911fba30def9e3202ac461a2d22831220124"
|
||||||
|
"checksum proc-macro2 0.4.20 (registry+https://github.com/rust-lang/crates.io-index)" = "3d7b7eaaa90b4a90a932a9ea6666c95a389e424eff347f0f793979289429feee"
|
||||||
|
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
|
||||||
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
|
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5"
|
||||||
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
|
"checksum rand 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8356f47b32624fef5b3301c1be97e5944ecdd595409cc5da11d05f211db6cfbd"
|
||||||
|
"checksum rand 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
|
||||||
|
"checksum rand_core 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "1961a422c4d189dfb50ffa9320bf1f2a9bd54ecb92792fb9477f99a1045f3372"
|
||||||
|
"checksum rand_core 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0905b6b7079ec73b314d4c748701f6931eb79fd97c668caa3f1899b22b32c6db"
|
||||||
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
"checksum redox_syscall 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "c214e91d3ecf43e9a4e41e578973adeb14b474f2bee858742d127af75a0112b1"
|
||||||
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
"checksum redox_termios 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "7e891cfe48e9100a70a3b6eb652fef28920c117d366339687bd5576160db0f76"
|
||||||
"checksum regex 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)" = "9329abc99e39129fcceabd24cf5d85b4671ef7c29c50e972bc5afe32438ec384"
|
"checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
|
||||||
"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e"
|
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
|
||||||
"checksum regex-syntax 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7d707a4fa2637f2dca2ef9fd02225ec7661fe01a53623c1e6515b6916511f7a7"
|
|
||||||
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
|
"checksum remove_dir_all 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3488ba1b9a2084d38645c4c08276a1752dcbf2c7130d74f1569681ad5d2799c5"
|
||||||
|
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
|
||||||
"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7"
|
"checksum ryu 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "7153dd96dade874ab973e098cb62fcdbb89a03682e46b144fd09550998d4a4a7"
|
||||||
"checksum safemem 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "e27a8b19b835f7aea908818e871f5cc3a5a186550c30773be987e155e8163d8f"
|
"checksum safemem 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8dca453248a96cb0749e36ccdfe2b0b4e54a61bfef89fb97ec621eb8e0a93dd9"
|
||||||
"checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c"
|
"checksum same-file 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "10f7794e2fda7f594866840e95f5c5962e886e228e68b6505885811a94dd728c"
|
||||||
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
"checksum scopeguard 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "94258f53601af11e6a49f722422f6e3425c52b06245a5cf9bc09908b174f5e27"
|
||||||
"checksum serde 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "22d340507cea0b7e6632900a176101fea959c7065d93ba555072da90aaaafc87"
|
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
|
||||||
"checksum serde_derive 1.0.75 (registry+https://github.com/rust-lang/crates.io-index)" = "234fc8b737737b148ccd625175fc6390f5e4dacfdaa543cb93a3430d984a9119"
|
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
|
||||||
"checksum serde_json 1.0.26 (registry+https://github.com/rust-lang/crates.io-index)" = "44dd2cfde475037451fa99b7e5df77aa3cfd1536575fa8e7a538ab36dcde49ae"
|
"checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9"
|
||||||
|
"checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe"
|
||||||
|
"checksum serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)" = "43344e7ce05d0d8280c5940cabb4964bea626aa58b1ec0e8c73fa2a8512a38ce"
|
||||||
|
"checksum shell-words 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "39acde55a154c4cd3ae048ac78cc21c25f3a0145e44111b523279113dce0d94a"
|
||||||
"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d"
|
"checksum smallvec 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "153ffa32fd170e9944f7e0838edf824a754ec4c1fc64746fcc9fe1f8fa602e5d"
|
||||||
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
"checksum stable_deref_trait 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "dba1a27d3efae4351c8051072d619e3ade2820635c3958d826bfea39d59b54c8"
|
||||||
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
"checksum strsim 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bb4f380125926a99e52bc279241539c018323fab05ad6368b56f93d9369ff550"
|
||||||
"checksum syn 0.14.9 (registry+https://github.com/rust-lang/crates.io-index)" = "261ae9ecaa397c42b960649561949d69311f08eeaea86a65696e6e46517cf741"
|
"checksum syn 0.15.9 (registry+https://github.com/rust-lang/crates.io-index)" = "b10ee269228fb723234fce98e9aac0eaed2bd5f1ad2f6930e8d5b93f04445a1a"
|
||||||
"checksum syntect 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc8a6f0db88d4afc340522c20d260411e746b2225b257c6b238a75de9d7cec78"
|
"checksum syntect 3.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "b76ed0acb8b4012c8ed2d3df01f018ac25c3fd916914768b4f4a8b8bebe106ff"
|
||||||
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
"checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8"
|
||||||
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
"checksum term_size 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "9e5b9a66db815dcfd2da92db471106457082577c3c278d4138ab3e3b4e189327"
|
||||||
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
"checksum termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)" = "689a3bdfaab439fd92bc87df5c4c78417d3cbe537487274e9b0b2dce76e92096"
|
||||||
"checksum termios 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a"
|
"checksum termios 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "72b620c5ea021d75a735c943269bb07d30c9b77d6ac6b236bc8b5c496ef05625"
|
||||||
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
"checksum textwrap 0.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "307686869c93e71f94da64286f9a9524c0f308a9e1c87a583de8e9c9039ad3f6"
|
||||||
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
"checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
|
||||||
"checksum time 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)" = "d825be0eb33fda1a7e68012d51e9c7f451dc1a69391e7fdc197060bb8c56667b"
|
"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
|
||||||
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
|
"checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
|
||||||
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
||||||
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
|
"checksum unicode-normalization 0.1.7 (registry+https://github.com/rust-lang/crates.io-index)" = "6a0180bc61fc5a987082bfa111f4cc95c4caff7f9799f3e46df09163a937aa25"
|
||||||
@@ -827,14 +1038,16 @@ dependencies = [
|
|||||||
"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6"
|
"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6"
|
||||||
"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4"
|
"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4"
|
||||||
"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d"
|
"checksum vcpkg 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "def296d3eb3b12371b2c7d0e83bfe1403e4db2d7a0bba324a12b21c4ee13143d"
|
||||||
"checksum version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "7716c242968ee87e5542f8021178248f267f295a5c4803beae8b8b7fd9bc6051"
|
"checksum vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "05c78687fb1a80548ae3250346c3db86a80a7cdd77bda190189f2d0a0987c81a"
|
||||||
|
"checksum version_check 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "914b1a6776c4c929a602fafd8bc742e06365d4bcbe48c30f9cca5824f70dc9dd"
|
||||||
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
"checksum void 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
|
||||||
"checksum walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "af464bc7be7b785c7ac72e266a6b67c4c9070155606f51655a650a6686204e35"
|
"checksum walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)" = "af464bc7be7b785c7ac72e266a6b67c4c9070155606f51655a650a6686204e35"
|
||||||
|
"checksum wild 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "690e5dbd46cfaf2f3bd09875ad94e92cc56459fce505807d6ce5332671aa93ae"
|
||||||
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
|
||||||
"checksum winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "773ef9dcc5f24b7d850d0ff101e542ff24c3b090a9768e03ff889fdef41f00fd"
|
"checksum winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0"
|
||||||
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"
|
||||||
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
"checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||||
"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
|
"checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
|
||||||
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
"checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||||
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
"checksum xml-rs 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3c1cb601d29fe2c2ac60a2b2e5e293994d87a1f6fa9687a31a15270f909be9c2"
|
||||||
"checksum yaml-rust 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "57ab38ee1a4a266ed033496cf9af1828d8d6e6c1cfa5f643a2809effcae4d628"
|
"checksum yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "95acf0db5515d07da9965ec0e0ba6cc2d825e2caeb7303b66ca441729801254e"
|
||||||
|
|||||||
+12
-2
@@ -7,18 +7,24 @@ license = "MIT/Apache-2.0"
|
|||||||
name = "bat"
|
name = "bat"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
repository = "https://github.com/sharkdp/bat"
|
repository = "https://github.com/sharkdp/bat"
|
||||||
version = "0.6.0"
|
version = "0.8.0"
|
||||||
exclude = [
|
exclude = [
|
||||||
"assets/syntaxes/*",
|
"assets/syntaxes/*",
|
||||||
"assets/themes/*",
|
"assets/themes/*",
|
||||||
]
|
]
|
||||||
|
build = "build.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
atty = "0.2.2"
|
atty = "0.2.2"
|
||||||
ansi_term = "0.11"
|
ansi_term = "0.11"
|
||||||
|
ansi_colours = "^1.0"
|
||||||
console = "0.6"
|
console = "0.6"
|
||||||
directories = "1.0"
|
directories = "1.0"
|
||||||
lazy_static = "1.0"
|
lazy_static = "1.0"
|
||||||
|
wild = "2.0"
|
||||||
|
content_inspector = "0.2.3"
|
||||||
|
encoding = "0.2"
|
||||||
|
shell-words = "0.1.0"
|
||||||
|
|
||||||
[dependencies.git2]
|
[dependencies.git2]
|
||||||
version = "0.7"
|
version = "0.7"
|
||||||
@@ -26,7 +32,7 @@ default-features = false
|
|||||||
features = []
|
features = []
|
||||||
|
|
||||||
[dependencies.syntect]
|
[dependencies.syntect]
|
||||||
version = "2.1"
|
version = "3.0.1"
|
||||||
default-features = false
|
default-features = false
|
||||||
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
features = ["parsing", "yaml-load", "dump-load", "dump-create"]
|
||||||
|
|
||||||
@@ -42,3 +48,7 @@ features = []
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempdir = "0.3"
|
tempdir = "0.3"
|
||||||
|
assert_cmd = "0.10.1"
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
clap = "2.32"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
<img src="doc/logo-header.svg" alt="bat - a cat clone with wings"><br>
|
||||||
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
<a href="https://travis-ci.org/sharkdp/bat"><img src="https://travis-ci.org/sharkdp/bat.svg?branch=master" alt="Build Status"></a>
|
||||||
|
<a href="https://ci.appveyor.com/project/sharkdp/bat"><img src="https://ci.appveyor.com/api/projects/status/cptsmtbiwbnr2vhf?svg=true"></a>
|
||||||
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
<img src="https://img.shields.io/crates/l/bat.svg" alt="license">
|
||||||
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
<a href="https://crates.io/crates/bat"><img src="https://img.shields.io/crates/v/bat.svg?colorB=319e8c" alt="Version info"></a><br>
|
||||||
A <i>cat(1)</i> clone with syntax highlighting and Git integration.
|
A <i>cat(1)</i> clone with syntax highlighting and Git integration.
|
||||||
@@ -52,15 +53,18 @@ Display multiple files at once
|
|||||||
> bat src/*.rs
|
> bat src/*.rs
|
||||||
```
|
```
|
||||||
|
|
||||||
Read from stdin, explicitly specify the language
|
Read from stdin, determine the syntax automatically
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> curl -s https://sh.rustup.rs | bat
|
||||||
|
```
|
||||||
|
|
||||||
|
Read from stdin, specify the language explicitly
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
> yaml2json .travis.yml | json_pp | bat -l json
|
> yaml2json .travis.yml | json_pp | bat -l json
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
|
||||||
> curl -s https://raw.githubusercontent.com/sharkdp/bat/master/src/main.rs | bat -l rs
|
|
||||||
```
|
|
||||||
|
|
||||||
As a replacement for `cat`:
|
As a replacement for `cat`:
|
||||||
|
|
||||||
@@ -82,7 +86,7 @@ bat f - g # output 'f', then stdin, then 'g'.
|
|||||||
Download the latest `.deb` package from the [release page](https://github.com/sharkdp/bat/releases)
|
Download the latest `.deb` package from the [release page](https://github.com/sharkdp/bat/releases)
|
||||||
and install it via:
|
and install it via:
|
||||||
``` bash
|
``` bash
|
||||||
sudo dpkg -i bat_0.6.0_amd64.deb # adapt version number and architecture
|
sudo dpkg -i bat_0.8.0_amd64.deb # adapt version number and architecture
|
||||||
```
|
```
|
||||||
|
|
||||||
### On Arch Linux
|
### On Arch Linux
|
||||||
@@ -116,6 +120,14 @@ cd /usr/ports/textproc/bat
|
|||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Via nix
|
||||||
|
|
||||||
|
You can install `bat` using the [nix package manager](https://nixos.org/nix):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix-env -i bat
|
||||||
|
```
|
||||||
|
|
||||||
### On macOS
|
### On macOS
|
||||||
|
|
||||||
You can install `bat` with [Homebrew](http://braumeister.org/formula/bat):
|
You can install `bat` with [Homebrew](http://braumeister.org/formula/bat):
|
||||||
@@ -124,22 +136,71 @@ You can install `bat` with [Homebrew](http://braumeister.org/formula/bat):
|
|||||||
brew install bat
|
brew install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### On Windows
|
||||||
|
|
||||||
|
You can download prebuilt binaries from the [Release page](https://github.com/sharkdp/bat/releases),
|
||||||
|
or install it with [scoop](https://scoop.sh/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scoop install bat
|
||||||
|
```
|
||||||
|
|
||||||
|
[See below](#using-bat-on-windows) for notes.
|
||||||
|
|
||||||
|
### Via Docker
|
||||||
|
|
||||||
|
There is a [Docker image](https://hub.docker.com/r/danlynn/bat/) that you can use to run `bat` in a container:
|
||||||
|
```bash
|
||||||
|
docker pull danlynn/bat
|
||||||
|
alias bat='docker run -it --rm -e BAT_THEME -e BAT_STYLE -e BAT_TABS -v "$(pwd):/myapp" danlynn/bat'
|
||||||
|
```
|
||||||
|
|
||||||
|
### Via Ansible
|
||||||
|
|
||||||
|
You can install `bat` with [Ansible](https://www.ansible.com/):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Install role on local machine
|
||||||
|
ansible-galaxy install aeimer.install_bat
|
||||||
|
```
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
---
|
||||||
|
# Playbook to install bat
|
||||||
|
- host: all
|
||||||
|
roles:
|
||||||
|
- aeimer.install_bat
|
||||||
|
```
|
||||||
|
|
||||||
|
- [Ansible Galaxy](https://galaxy.ansible.com/aeimer/install_bat)
|
||||||
|
- [GitHub](https://github.com/aeimer/ansible-install-bat)
|
||||||
|
|
||||||
|
This should work with the following distributions:
|
||||||
|
- Debian/Ubuntu
|
||||||
|
- ARM (eg. Raspberry PI)
|
||||||
|
- Arch Linux
|
||||||
|
- Void Linux
|
||||||
|
- FreeBSD
|
||||||
|
- MacOS
|
||||||
|
|
||||||
### From binaries
|
### From binaries
|
||||||
|
|
||||||
Check out the [Release page](https://github.com/sharkdp/bat/releases) for
|
Check out the [Release page](https://github.com/sharkdp/bat/releases) for
|
||||||
prebuilt versions of `bat` for many different architectures.
|
prebuilt versions of `bat` for many different architectures. Statically-linked
|
||||||
|
binaries are available, just look for releases with `musl` in the name on the
|
||||||
|
releases page.
|
||||||
|
|
||||||
### From source
|
### From source
|
||||||
|
|
||||||
If you want to build `bat` from source, you need Rust 1.26 or
|
If you want to build `bat` from source, you need Rust 1.29 or
|
||||||
higher. You can then use `cargo` to build everything:
|
higher. You can then use `cargo` to build everything:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install bat
|
cargo install bat
|
||||||
```
|
```
|
||||||
|
|
||||||
On macOS, you might have to install `cmake` (`brew install cmake`) in order for
|
You may have to install `cmake` and the `libz` development package
|
||||||
some dependencies to be built.
|
(`libz-dev` or `libz-devel`) in order for the build to succeed.
|
||||||
|
|
||||||
## Customization
|
## Customization
|
||||||
|
|
||||||
@@ -148,14 +209,26 @@ some dependencies to be built.
|
|||||||
Use `bat --list-themes` to get a list of all available themes for syntax
|
Use `bat --list-themes` to get a list of all available themes for syntax
|
||||||
highlighting. To select the `TwoDark` theme, call `bat` with the
|
highlighting. To select the `TwoDark` theme, call `bat` with the
|
||||||
`--theme=TwoDark` option or set the `BAT_THEME` environment variable to
|
`--theme=TwoDark` option or set the `BAT_THEME` environment variable to
|
||||||
`TwoDark`. Use `export BAT_THEME="TwoDark"` in your shells startup file to
|
`TwoDark`. Use `export BAT_THEME="TwoDark"` in your shell's startup file to
|
||||||
make the change permanent.
|
make the change permanent.
|
||||||
|
|
||||||
|
If you want to preview the different themes on a custom file, you can use
|
||||||
|
the following command (you need [`fzf`](https://github.com/junegunn/fzf) for this):
|
||||||
|
``` bash
|
||||||
|
bat --list-themes | fzf --preview="bat --theme={} --color=always /path/to/file"
|
||||||
|
```
|
||||||
|
|
||||||
|
`bat` looks good on a dark background by default. However, if your terminal uses a
|
||||||
|
light background, some themes will work better for you. For example, the `GitHub`
|
||||||
|
theme is made for light backgrounds. You can also make your own theme by following the
|
||||||
|
['Adding new themes' section below](https://github.com/sharkdp/bat#adding-new-themes).
|
||||||
|
|
||||||
### Output style
|
### Output style
|
||||||
|
|
||||||
You can use the `--style` option to control the appearance of `bat`s output.
|
You can use the `--style` option to control the appearance of `bat`s output.
|
||||||
You can use `--style=numbers,changes`, for example, to show only Git changes
|
You can use `--style=numbers,changes`, for example, to show only Git changes
|
||||||
and line numbers but no grid and no file header.
|
and line numbers but no grid and no file header. Use the `BAT_STYLE` environment
|
||||||
|
variable to make these changes permanent.
|
||||||
|
|
||||||
### Adding new syntaxes / language definitions
|
### Adding new syntaxes / language definitions
|
||||||
|
|
||||||
@@ -216,13 +289,72 @@ Finally, use `bat --list-themes` to check if the new themes are available.
|
|||||||
`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
|
`bat` uses the pager that is specified in the `PAGER` environment variable. If this variable is not
|
||||||
set, `less` is used by default. If you want to use a different pager, you can either modify the
|
set, `less` is used by default. If you want to use a different pager, you can either modify the
|
||||||
`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
|
`PAGER` variable or set the `BAT_PAGER` environment variable to override what is specified in
|
||||||
`PAGER`. If you want to pass command-line arguments to the pager, you need to create a small shell
|
`PAGER`.
|
||||||
script as a wrapper, for example:
|
|
||||||
|
If you want to pass command-line arguments to the pager, you need to create a small shell
|
||||||
|
script as a wrapper, for example
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
less --tabs 4 -RF "$@"
|
less --tabs 4 -R "$@"
|
||||||
|
```
|
||||||
|
(put this in a file `~/.bat-pager.sh`, make it executable `chmod +x ~/.bat-pager.sh` and use
|
||||||
|
`export BAT_PAGER="$HOME/.bat-pager.sh"` in your shells `rc` file)
|
||||||
|
|
||||||
|
**Note**: By default, if the pager is set to `less`, `bat` will pass the following command line
|
||||||
|
options to the pager: `-R`/`--RAW-CONTROL-CHARS`, `-F`/`--quit-if-one-screen` and `-X`/`--no-init`.
|
||||||
|
The first (`-R`) is needed to interpret ANSI colors correctly. The second option (`-F`) 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
|
||||||
|
third option (`-X`) is needed to fix a bug with the `--quit-if-one-screen` feature in old versions
|
||||||
|
of `less`. Unfortunately, it also breaks mouse-wheel support in `less`. If you want to enable
|
||||||
|
mouse-wheel scrolling, you can either pass just `-R` (as in the example above, this will disable
|
||||||
|
the quit-if-one-screen feature), or you can use a recent version of `less` and pass `-RF` which
|
||||||
|
will hopefully enable both quit-if-one-screen and mouse-wheel scrolling.
|
||||||
|
|
||||||
|
If scrolling still doesn't work for you, you can try to pass the `-S` option in addition.
|
||||||
|
|
||||||
|
## Using `bat` on Windows
|
||||||
|
|
||||||
|
`bat` mostly works out-of-the-box on Windows, but a few features may need extra configuration.
|
||||||
|
|
||||||
|
### Paging
|
||||||
|
|
||||||
|
Windows only includes a very limited pager in the form of `more`. You can download a Windows binary
|
||||||
|
for `less` [from its homepage](http://www.greenwoodsoftware.com/less/download.html) or [through
|
||||||
|
Chocolatey](https://chocolatey.org/packages/Less). To use it, place the binary in a directory in
|
||||||
|
your `PATH` or [define an environment variable](#using-a-different-pager).
|
||||||
|
|
||||||
|
### Colours
|
||||||
|
|
||||||
|
Windows 10 natively supports colours in both `conhost.exe` (Command Prompt) and PowerShell since
|
||||||
|
[v1511](https://en.wikipedia.org/wiki/Windows_10_version_history#Version_1511_(November_Update)), as
|
||||||
|
well as in newer versions of bash. On earlier versions of Windows, you can use
|
||||||
|
[Cmder](http://cmder.net/), which includes [ConEmu](https://conemu.github.io/).
|
||||||
|
|
||||||
|
**Note:** The Git and MSYS versions of `less` do not correctly interpret colours on Windows. If you
|
||||||
|
don’t have any other pagers installed, you can disable paging entirely by passing `--paging=never`
|
||||||
|
or by setting `BAT_PAGER` to an empty string.
|
||||||
|
|
||||||
|
### Cygwin
|
||||||
|
|
||||||
|
`bat` on Windows does not natively support Cygwin's unix-style paths (`/cygdrive/*`). When passed an absolute cygwin path as an argument, `bat` will encounter the following error: `The system cannot find the path specified. (os error 3)`
|
||||||
|
|
||||||
|
This can be solved by creating a wrapper or adding the following function to your `.bash_profile` file:
|
||||||
|
|
||||||
|
```shell
|
||||||
|
bat() {
|
||||||
|
local index
|
||||||
|
local args=("$@")
|
||||||
|
for index in $(seq 0 ${#args[@]}) ; do
|
||||||
|
case "${args[index]}" in
|
||||||
|
-*) continue;;
|
||||||
|
*) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
command bat "${args[@]}"
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
@@ -239,6 +371,11 @@ Make sure that your truecolor terminal sets the `COLORTERM` variable to either `
|
|||||||
`24bit`. Otherwise, `bat` will not be able to determine whether or not 24-bit escape sequences
|
`24bit`. Otherwise, `bat` will not be able to determine whether or not 24-bit escape sequences
|
||||||
are supported (and fall back to 8-bit colors).
|
are supported (and fall back to 8-bit colors).
|
||||||
|
|
||||||
|
### Line numbers and grid are hardly visible
|
||||||
|
|
||||||
|
Please try a different theme (see `bat --list-themes` for a list). The `OneHalfDark` and
|
||||||
|
`OneHalfLight` themes provide grid and line colors that are brighter.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
environment:
|
||||||
|
global:
|
||||||
|
TARGET: x86_64-pc-windows-msvc
|
||||||
|
RUST_VERSION: stable
|
||||||
|
CRATE_NAME: bat
|
||||||
|
CARGO_HOME: "c:\\cargo"
|
||||||
|
RUSTUP_HOME: "c:\\rustup"
|
||||||
|
|
||||||
|
install:
|
||||||
|
- appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe
|
||||||
|
- rustup-init.exe -y --default-host %TARGET%
|
||||||
|
- set PATH=%PATH%;C:\cargo\bin
|
||||||
|
- rustc -Vv
|
||||||
|
- cargo -V
|
||||||
|
|
||||||
|
build: false
|
||||||
|
test_script:
|
||||||
|
- cargo test --target %TARGET% --verbose
|
||||||
|
- cargo run --target %TARGET% -- src/main.rs README.md --paging=never
|
||||||
|
|
||||||
|
before_deploy:
|
||||||
|
# Generate artifacts for release
|
||||||
|
- cargo build --release --verbose
|
||||||
|
- ps: ci\before_deploy.ps1
|
||||||
|
|
||||||
|
deploy:
|
||||||
|
description: 'Automatically deployed release'
|
||||||
|
artifact: /.*\.zip/
|
||||||
|
# Here's how:
|
||||||
|
# - Go to 'https://github.com/settings/tokens/new' and generate a Token with only the
|
||||||
|
# `public_repo` scope enabled
|
||||||
|
# - Then go to 'https://ci.appveyor.com/tools/encrypt' and enter the newly generated token.
|
||||||
|
# - Enter the "encrypted value" below
|
||||||
|
auth_token:
|
||||||
|
secure: oO4/J+hcFXgXcEqEc8gzlQNqLG0IxU78s4EyH+uczGdsyWajb3yipxPR6nXUvmoj
|
||||||
|
provider: GitHub
|
||||||
|
on:
|
||||||
|
RUST_VERSION: stable
|
||||||
|
appveyor_repo_tag: true
|
||||||
|
|
||||||
|
cache:
|
||||||
|
- C:\Users\appveyor\.cargo\registry
|
||||||
|
- target
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
- provider: Email
|
||||||
|
on_build_success: false
|
||||||
|
on_build_failure: false
|
||||||
|
on_build_status_changed: false
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
diff --git syntaxes/Packages/Java/JavaDoc.sublime-syntax syntaxes/Packages/Java/JavaDoc.sublime-syntax
|
||||||
|
index 422a6a9..40a741e 100644
|
||||||
|
--- syntaxes/Packages/Java/JavaDoc.sublime-syntax
|
||||||
|
+++ syntaxes/Packages/Java/JavaDoc.sublime-syntax
|
||||||
|
@@ -13,7 +13,7 @@ variables:
|
||||||
|
contexts:
|
||||||
|
prototype:
|
||||||
|
# https://docs.oracle.com/javase/7/docs/technotes/tools/windows/javadoc.html#leadingasterisks
|
||||||
|
- - match: ^\s*(\*)\s*(?!\s*@)
|
||||||
|
+ - match: ^\s*(\*)(?!/)\s*(?!\s*@)
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.javadoc
|
||||||
|
|
||||||
+2
-1
@@ -28,4 +28,5 @@ themes (`bat cache --clear`).
|
|||||||
|
|
||||||
The following files have been manually modified after converting from a `.tmLanguage` file:
|
The following files have been manually modified after converting from a `.tmLanguage` file:
|
||||||
|
|
||||||
* `VimL.sublime-syntax` => added `.vimrc` file type.
|
* `Dart.sublime-syntax` => removed `#regex.dart` include.
|
||||||
|
* `INI.sublime-syntax` => added `.hgrc` and `hgrc` file types.
|
||||||
|
|||||||
Regular → Executable
+11
@@ -2,4 +2,15 @@
|
|||||||
|
|
||||||
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
ASSET_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||||
|
|
||||||
|
# Always remove the local cache to avoid any confusion
|
||||||
|
bat cache --clear
|
||||||
|
|
||||||
|
# TODO: Remove this (and the reverse part below) when
|
||||||
|
# https://github.com/trishume/syntect/issues/160 has been fixed
|
||||||
|
JAVADOC_FILE="${ASSET_DIR}/syntaxes/Packages/Java/JavaDoc.sublime-syntax"
|
||||||
|
JAVADOC_PATCH="${ASSET_DIR}/JavaDoc.sublime-syntax.patch"
|
||||||
|
patch "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
||||||
|
|
||||||
bat cache --init --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
bat cache --init --blank --source="$ASSET_DIR" --target="$ASSET_DIR"
|
||||||
|
|
||||||
|
patch -R "$JAVADOC_FILE" "$JAVADOC_PATCH"
|
||||||
|
|||||||
Binary file not shown.
Submodule
+1
Submodule assets/syntaxes/CSV added at 4786d037a7
@@ -0,0 +1,46 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Advanced CSV
|
||||||
|
file_extensions:
|
||||||
|
- csv
|
||||||
|
- tsv
|
||||||
|
scope: text.advanced_csv
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: (\")
|
||||||
|
captures:
|
||||||
|
1: string.quoted.double.advanced_csv
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.quoted.advanced_csv
|
||||||
|
- match: (\")
|
||||||
|
captures:
|
||||||
|
1: string.quoted.double.advanced_csv
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: '(\[([+-]?\d*)(\:)?([+-]?\d*)(\,)?([+-]?\d*)(\:)?([+-]?\d*)\])?\s*([<>v^])?\s*(=)'
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.advanced_csv
|
||||||
|
2: constant.numeric.formula.advanced_csv
|
||||||
|
4: constant.numeric.formula.advanced_csv
|
||||||
|
6: constant.numeric.formula.advanced_csv
|
||||||
|
8: constant.numeric.formula.advanced_csv
|
||||||
|
9: keyword.operator.advanced_csv
|
||||||
|
10: keyword.operator.advanced_csv
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.range.advanced_csv
|
||||||
|
- match: (?=(\")|$)
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.python
|
||||||
|
- match: '(?<=^|,|\s|\")([0-9.eE+-]+)(?=$|,|\s|\")'
|
||||||
|
scope: meta.number.advanced_csv
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.advanced_csv
|
||||||
|
- match: '(?<=^|,|\s|\")([^, \t\"]+)(?=$|,|\s|\")'
|
||||||
|
scope: meta.nonnumber.advanced_csv
|
||||||
|
captures:
|
||||||
|
1: storage.type.advanced_csv
|
||||||
|
- match: (\,)
|
||||||
|
scope: meta.delimiter.advanced_csv
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.advanced_csv
|
||||||
Submodule
+1
Submodule assets/syntaxes/Cabal added at 1c054d9b36
@@ -0,0 +1,47 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Cabal
|
||||||
|
file_extensions:
|
||||||
|
- cabal
|
||||||
|
scope: source.cabal
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: ^(\s*)(exposed-modules):$
|
||||||
|
captures:
|
||||||
|
2: constant.other.cabal
|
||||||
|
push:
|
||||||
|
- meta_scope: exposed.modules.cabal
|
||||||
|
- match: ^(?!\1\s)
|
||||||
|
pop: true
|
||||||
|
- include: module_name
|
||||||
|
- match: ^(\s*)(build-depends):$
|
||||||
|
captures:
|
||||||
|
2: constant.other.cabal
|
||||||
|
push:
|
||||||
|
- meta_scope: exposed.modules.cabal
|
||||||
|
- match: ^(?!\1\s)
|
||||||
|
pop: true
|
||||||
|
- match: "([<>=]+)|([&|]+)"
|
||||||
|
scope: keyword.operator.haskell
|
||||||
|
- match: ((\d+|\*)\.)*(\d+|\*)
|
||||||
|
scope: constant.numeric.haskell
|
||||||
|
- match: '([\w\-]+)'
|
||||||
|
scope: support.function.haskell
|
||||||
|
- match: '^\s*([a-zA-Z_-]+)(:)\s+'
|
||||||
|
scope: entity.cabal
|
||||||
|
captures:
|
||||||
|
1: constant.other.cabal
|
||||||
|
2: punctuation.entity.cabal
|
||||||
|
- match: '^(?i)(executable|library|test-suite|benchmark|flag|source-repository)\s+([^\s,]+)\s*$'
|
||||||
|
scope: entity.cabal
|
||||||
|
captures:
|
||||||
|
1: keyword.entity.cabal
|
||||||
|
2: string.cabal
|
||||||
|
- match: ^(?i)library\s*$
|
||||||
|
scope: keyword.entity.cabal
|
||||||
|
- match: "--.*$"
|
||||||
|
scope: comment.cabal
|
||||||
|
module_name:
|
||||||
|
- match: '([A-Z][A-Za-z_''0-9]*)(\.[A-Z][A-Za-z_''0-9]*)*'
|
||||||
|
scope: storage.module.haskell
|
||||||
Submodule
+1
Submodule assets/syntaxes/Crystal added at 2f96cec2ca
File diff suppressed because it is too large
Load Diff
Submodule
+1
Submodule assets/syntaxes/Dart added at d891fb36c9
@@ -0,0 +1,369 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Dart
|
||||||
|
file_extensions:
|
||||||
|
- dart
|
||||||
|
scope: source.dart
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: ^(#!.*)$
|
||||||
|
scope: meta.preprocessor.script.dart
|
||||||
|
- match: ^\s*\b(library|import|export|part of|part)\b
|
||||||
|
captures:
|
||||||
|
0: keyword.other.import.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.dart
|
||||||
|
- match: ;
|
||||||
|
captures:
|
||||||
|
0: punctuation.terminator.dart
|
||||||
|
pop: true
|
||||||
|
- include: strings
|
||||||
|
- match: \b(as|show|hide|deferred)\b
|
||||||
|
scope: keyword.other.import.dart
|
||||||
|
- include: comments
|
||||||
|
- include: constants-and-special-vars
|
||||||
|
- include: annotations
|
||||||
|
- include: decl-typedef
|
||||||
|
- include: decl-class
|
||||||
|
- include: decl-enum
|
||||||
|
- include: decl-function
|
||||||
|
- include: keywords
|
||||||
|
- include: strings
|
||||||
|
annotations:
|
||||||
|
- match: '^(?:\s*)((@)([a-zA-Z0-9_]+))'
|
||||||
|
captures:
|
||||||
|
1: annotation.dart
|
||||||
|
2: entity.name.function.annotation.dart
|
||||||
|
3: support.type.dart
|
||||||
|
comments:
|
||||||
|
- match: /\*\*/
|
||||||
|
scope: comment.block.empty.dart
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.dart
|
||||||
|
- include: comments-inline
|
||||||
|
comments-inline:
|
||||||
|
- match: /\*
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.dart
|
||||||
|
- match: \*/
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.dart-doccomments
|
||||||
|
- match: (///)
|
||||||
|
captures:
|
||||||
|
1: marker.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line.triple-slash.dart
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.dart-doccomments
|
||||||
|
- match: (//)
|
||||||
|
captures:
|
||||||
|
1: marker.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line.double-slash.dart
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- include: scope:text.dart-doccomments
|
||||||
|
constants-and-special-vars:
|
||||||
|
- match: \b(true|false|null)\b
|
||||||
|
scope: constant.language.dart
|
||||||
|
- match: \b(this|super)\b
|
||||||
|
scope: variable.language.dart
|
||||||
|
- match: '\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\.?[0-9]*)|(\.[0-9]+))((e|E)(\+|-)?[0-9]+)?)\b'
|
||||||
|
scope: constant.numeric.dart
|
||||||
|
decl-class:
|
||||||
|
- match: \bclass\b
|
||||||
|
captures:
|
||||||
|
0: keyword.control.new.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.class.dart
|
||||||
|
- match: "(?={)"
|
||||||
|
pop: true
|
||||||
|
- include: keywords
|
||||||
|
- match: "[A-Za-z_][A-Za-z0-9_]*"
|
||||||
|
scope: class.name.dart
|
||||||
|
decl-enum:
|
||||||
|
- match: \benum\b
|
||||||
|
captures:
|
||||||
|
0: keyword.declaration.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.enum.dart
|
||||||
|
- match: "(?={)"
|
||||||
|
pop: true
|
||||||
|
- include: keywords
|
||||||
|
- match: "[A-Za-z_][A-Za-z0-9_]*"
|
||||||
|
scope: enum.name.dart
|
||||||
|
decl-function:
|
||||||
|
- match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(get)\s+(\w+)\s+(?==>)
|
||||||
|
comment: A getter with a primitive return type.
|
||||||
|
scope: meta.declaration.function.dart
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: keyword.declaration.dart
|
||||||
|
3: function.name.dart
|
||||||
|
- match: ^\s*(?:\b(\w+)\b\s+)?(get)\s+(\w+)\s+(?==>)
|
||||||
|
comment: A getter with a user-defined return type or no return type.
|
||||||
|
scope: meta.declaration.function.dart
|
||||||
|
captures:
|
||||||
|
1: type.user-defined.dart
|
||||||
|
2: keyword.declaration.dart
|
||||||
|
3: function.name.dart
|
||||||
|
- match: ^\s*(set)\s+(\w+)(?=\()
|
||||||
|
comment: A setter.
|
||||||
|
captures:
|
||||||
|
1: keyword.declaration.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: ^\s*(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function with a primitive return type.
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: ^\s*(?:\b(return)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function invocation after 'return'
|
||||||
|
captures:
|
||||||
|
1: keyword.control.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.invocation.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: ^\s*\b(new)\b\s+(\w+)(?=\()
|
||||||
|
comment: A class instantiation after 'new'
|
||||||
|
captures:
|
||||||
|
1: keyword.declaration.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.invocation.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: comments-inline
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
decl-function-parameter:
|
||||||
|
- include: constants-and-special-vars
|
||||||
|
- match: (?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function with a primitive return type.
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: \b(new)\b\s+(\w+)(?=\()
|
||||||
|
comment: A class instantiation after 'new'
|
||||||
|
captures:
|
||||||
|
1: keyword.declaration.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.invocation.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: (?:\b(\w+)\b)\s+(\w+)(?=\()
|
||||||
|
comment: A function with a user-defined return type.
|
||||||
|
captures:
|
||||||
|
1: type.user-defined.dart
|
||||||
|
2: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
- match: (\w+)(?=\()
|
||||||
|
comment: A function with no return type.
|
||||||
|
captures:
|
||||||
|
1: function.name.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter.function.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: decl-function-parameter
|
||||||
|
- include: strings
|
||||||
|
- include: keywords
|
||||||
|
decl-typedef:
|
||||||
|
- match: typedef
|
||||||
|
captures:
|
||||||
|
0: keyword.control.new.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.declaration.typedef.dart
|
||||||
|
- match: ;
|
||||||
|
captures:
|
||||||
|
0: punctuation.terminator.dart
|
||||||
|
pop: true
|
||||||
|
- match: '(?:\b(void|bool|num|int|double|dynamic|var|String|List|Map)\b|([a-zA-Z_][a-zA-Z0-9_]*))\s+([a-zA-Z_][a-zA-Z0-9_]+)'
|
||||||
|
captures:
|
||||||
|
1: storage.type.primitive.dart
|
||||||
|
2: typedef.return.dart
|
||||||
|
3: typedef.name.dart
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- meta_scope: typedef.params.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: keywords
|
||||||
|
keywords:
|
||||||
|
- match: \bassert\b
|
||||||
|
scope: keyword.control.assert.dart
|
||||||
|
- match: \bas\b
|
||||||
|
scope: keyword.cast.dart
|
||||||
|
- match: \b(try|catch|finally|throw|on|rethrow)\b
|
||||||
|
scope: keyword.control.catch-exception.dart
|
||||||
|
- match: \s+\?\s+|\s+:\s+
|
||||||
|
scope: keyword.control.ternary.dart
|
||||||
|
- match: \b(break|case|continue|default|do|else|for|if|in|return|switch|while)\b
|
||||||
|
scope: keyword.control.dart
|
||||||
|
- match: \b(async\*|async|await\*|await|yield)\b
|
||||||
|
scope: keyword.control.async.dart
|
||||||
|
- match: \b(new)\b
|
||||||
|
scope: keyword.control.new.dart
|
||||||
|
- match: \b(abstract|extends|external|factory|implements|with|interface|get|native|operator|set|typedef)\b
|
||||||
|
scope: keyword.declaration.dart
|
||||||
|
- match: \b(is\!?)\b
|
||||||
|
scope: keyword.operator.dart
|
||||||
|
- match: (<<|>>>?|~|\^|\||&)
|
||||||
|
scope: keyword.operator.bitwise.dart
|
||||||
|
- match: ((&|\^|\||<<|>>>?)=)
|
||||||
|
scope: keyword.operator.assignment.bitwise.dart
|
||||||
|
- match: (===?|!==?|<=?|>=?)
|
||||||
|
scope: keyword.operator.comparison.dart
|
||||||
|
- match: '(([+*/%-]|\~)=)'
|
||||||
|
scope: keyword.operator.assignment.arithmetic.dart
|
||||||
|
- match: (=)
|
||||||
|
scope: keyword.operator.assignment.dart
|
||||||
|
- match: (\-\-|\+\+)
|
||||||
|
scope: keyword.operator.increment-decrement.dart
|
||||||
|
- match: (\-|\+|\*|\/|\~\/|%)
|
||||||
|
scope: keyword.operator.arithmetic.dart
|
||||||
|
- match: (!|&&|\|\|)
|
||||||
|
scope: keyword.operator.logical.dart
|
||||||
|
- match: ;
|
||||||
|
scope: punctuation.terminator.dart
|
||||||
|
- match: \b(static|final|const)\b
|
||||||
|
scope: storage.modifier.dart
|
||||||
|
- match: \b(?:void|bool|num|int|double|dynamic|var|String|List|Map)\b
|
||||||
|
scope: storage.type.primitive.dart
|
||||||
|
regexp:
|
||||||
|
- match: '\\[^''"]'
|
||||||
|
scope: constant.character.escaped.regex.dart
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- meta_content_scope: meta.capture.regex.dart
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- match: \?(:|=|!)
|
||||||
|
scope: ignore.capture.regex.dart
|
||||||
|
- match: \*|\+|\?|\.|\|
|
||||||
|
scope: keyword.other.regex.dart
|
||||||
|
- match: \^|\$
|
||||||
|
scope: keyword.other.regex.dart
|
||||||
|
- match: \.
|
||||||
|
scope: constant.other.regex.dart
|
||||||
|
- match: '\[(\^)?'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.negation.regex.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: constant.character.range.regex.dart
|
||||||
|
- match: '\]'
|
||||||
|
pop: true
|
||||||
|
- match: '\\[^"'']'
|
||||||
|
scope: constant.character.escaped.regex.dart
|
||||||
|
- match: '\{(?:\d+)?,(?:\d+)?\}'
|
||||||
|
scope: keyword.other.regex.dart
|
||||||
|
string-interp:
|
||||||
|
- match: '(\$)(\{)'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.dart
|
||||||
|
2: keyword.other.dart
|
||||||
|
push:
|
||||||
|
- meta_scope: interpolation.dart
|
||||||
|
- meta_content_scope: source.dart
|
||||||
|
- match: '(\})'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.dart
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: (\$)(\w+)
|
||||||
|
captures:
|
||||||
|
1: keyword.other.dart
|
||||||
|
2: variable.parameter.dart
|
||||||
|
- match: \\.
|
||||||
|
scope: constant.character.escape.dart
|
||||||
|
strings:
|
||||||
|
- match: (?<!r)"""
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.triple.double.dart
|
||||||
|
- match: '"""(?!")'
|
||||||
|
pop: true
|
||||||
|
- include: string-interp
|
||||||
|
- match: (?<!r)'''
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.triple.single.dart
|
||||||
|
- match: "'''(?!')"
|
||||||
|
pop: true
|
||||||
|
- include: string-interp
|
||||||
|
- match: r"""
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.triple.double.dart
|
||||||
|
- match: '"""(?!")'
|
||||||
|
pop: true
|
||||||
|
- match: r'''
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.triple.single.dart
|
||||||
|
- match: "'''(?!')"
|
||||||
|
pop: true
|
||||||
|
- match: (?<!\\|r)"
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.double.dart
|
||||||
|
- match: '"'
|
||||||
|
pop: true
|
||||||
|
- match: \n
|
||||||
|
scope: invalid.string.newline
|
||||||
|
- include: string-interp
|
||||||
|
- match: r"
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.dart
|
||||||
|
- match: '"'
|
||||||
|
pop: true
|
||||||
|
- include: regexp
|
||||||
|
- match: (?<!\|r)'
|
||||||
|
push:
|
||||||
|
- meta_scope: string.interpolated.single.dart
|
||||||
|
- match: "'"
|
||||||
|
pop: true
|
||||||
|
- include: string-interp
|
||||||
|
- match: r'
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.dart
|
||||||
|
- match: "'"
|
||||||
|
pop: true
|
||||||
|
- include: regexp
|
||||||
Submodule
+1
Submodule assets/syntaxes/FSharp added at da846f4227
@@ -0,0 +1,234 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: "F#"
|
||||||
|
file_extensions:
|
||||||
|
- fs
|
||||||
|
- fsi
|
||||||
|
- fsx
|
||||||
|
scope: source.fsharp
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- include: comments
|
||||||
|
- include: constants
|
||||||
|
- include: structure
|
||||||
|
- include: attributes
|
||||||
|
- include: strings
|
||||||
|
- include: definition
|
||||||
|
- include: method_calls
|
||||||
|
- include: modules
|
||||||
|
- include: anonymous_functions
|
||||||
|
- include: keywords
|
||||||
|
anonymous_functions:
|
||||||
|
- match: \b(fun)\b
|
||||||
|
captures:
|
||||||
|
1: keyword.other.function-definition.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function.anonymous
|
||||||
|
- match: (->)
|
||||||
|
captures:
|
||||||
|
1: keyword.other.fsharp
|
||||||
|
pop: true
|
||||||
|
- include: variables
|
||||||
|
attributes:
|
||||||
|
- match: '\[\<'
|
||||||
|
push:
|
||||||
|
- meta_scope: support.function.attribute.fsharp
|
||||||
|
- match: '\>\]'
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
characters:
|
||||||
|
- match: (')
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.fsharp
|
||||||
|
- match: (')
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.end.fsharp
|
||||||
|
pop: true
|
||||||
|
- match: '\\$[ \t]*'
|
||||||
|
scope: punctuation.separator.string.ignore-eol.fsharp
|
||||||
|
- match: '\\([\\""ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})'
|
||||||
|
scope: constant.character.string.escape.fsharp
|
||||||
|
- match: '\\(?![\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).'
|
||||||
|
scope: invalid.illeagal.character.string.fsharp
|
||||||
|
comments:
|
||||||
|
- match: \(\*\*?(\*)\)
|
||||||
|
scope: comment.block.fsharp
|
||||||
|
captures:
|
||||||
|
1: comment.block.empty.fsharp
|
||||||
|
- match: '\(\*[^\)]'
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.fsharp
|
||||||
|
- match: \*\)
|
||||||
|
pop: true
|
||||||
|
- include: comments
|
||||||
|
- match: //.*$
|
||||||
|
scope: comment.line.double-slash.fsharp
|
||||||
|
constants:
|
||||||
|
- match: \(\)
|
||||||
|
scope: constant.language.unit.fsharp
|
||||||
|
- match: '\b-?[0-9][0-9_]*((\.([0-9][0-9_]*([eE][+-]??[0-9][0-9_]*)?)?)|([eE][+-]??[0-9][0-9_]*))'
|
||||||
|
scope: constant.numeric.floating-point.fsharp
|
||||||
|
- match: '\b(-?((0(x|X)[0-9a-fA-F][0-9a-fA-F_]*)|(0(o|O)[0-7][0-7_]*)|(0(b|B)[01][01_]*)|([0-9][0-9_]*)))'
|
||||||
|
scope: constant.numeric.integer.nativeint.fsharp
|
||||||
|
definition:
|
||||||
|
- match: '\b(val|val|let|and|member|override|use)\s?(rec|inline|mutable)?(\s+\(?([a-zA-Z.\|_][a-zA-Z0-9.|_]*)\)?\w*)\b'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.binding.fsharp
|
||||||
|
2: keyword.other.function-recursive.fsharp
|
||||||
|
3: variable.other.binding.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.binding.fsharp
|
||||||
|
- match: "=|$"
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.function.type-constraint.fsharp
|
||||||
|
pop: true
|
||||||
|
- include: variables
|
||||||
|
- match: \b(let)\s+((\(\))|(_))\s+=
|
||||||
|
scope: meta.expression.fsharp
|
||||||
|
captures:
|
||||||
|
1: keyword.other.binding.fsharp
|
||||||
|
2: keyword.other.function-recursive.fsharp
|
||||||
|
4: constant.language.unit.fsharp
|
||||||
|
5: constant.language.ignored.fsharp
|
||||||
|
keywords:
|
||||||
|
- match: ^\s*#\s*(light|if|else|endif|r|I|load|time|help|quit)\b
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.preprocessor.fsharp
|
||||||
|
- match: (\s|$)
|
||||||
|
pop: true
|
||||||
|
- match: \b(new|in|as|if|then|else|elif|for|begin|end|match|with|type|inherit|true|false|null|do)\b
|
||||||
|
scope: keyword.other.fsharp
|
||||||
|
- match: '(\|>|\|?>|\->|\<\-|:>|:|\[|\]|\;|\||_)'
|
||||||
|
scope: entity.name
|
||||||
|
method_calls:
|
||||||
|
- match: '(?<!\w)([a-z]\w*)(\.)'
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.method-call.fsharp
|
||||||
|
- match: '[A-Z]\w*(\.)'
|
||||||
|
scope: meta.method.fsharp
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.method-call.fsharp
|
||||||
|
- match: (?=.)
|
||||||
|
pop: true
|
||||||
|
modules:
|
||||||
|
- match: '\b(namespace|module)\s+([a-zA-Z][a-zA-Z0-9''_.]*)'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.fsharp
|
||||||
|
2: entity.name.section.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.module.namespace.fsharp
|
||||||
|
- match: (\s|$)
|
||||||
|
pop: true
|
||||||
|
- match: '(\.)([A-Z][a-zA-Z0-9''_]*)'
|
||||||
|
scope: support.other.module.fsharp
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.module-reference.fsharp
|
||||||
|
2: support.other.module.fsharp
|
||||||
|
- match: '\b(open)\s+([A-Z][a-zA-Z0-9''_]*)(?=(\.[A-Z][a-zA-Z0-9_]*)*)'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.fsharp
|
||||||
|
2: support.other.module.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.module.open.fsharp
|
||||||
|
- match: (\s|$)
|
||||||
|
pop: true
|
||||||
|
- match: '(\.)([A-Z][a-zA-Z0-9''_]*)'
|
||||||
|
scope: support.other.module.fsharp
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.module-reference.fsharp
|
||||||
|
2: support.other.module.fsharp
|
||||||
|
- match: '^\s*(module)\s+([A-Z][a-zA-Z0-9''_]*)\s*(=)\s*([A-Z][a-zA-Z0-9''_]*)'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.module-definition.fsharp
|
||||||
|
2: entity.name.type.module.fsharp
|
||||||
|
3: punctuation.separator.module-definition.fsharp
|
||||||
|
4: support.other.module.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.module.alias.fsharp
|
||||||
|
- match: (\s|$)
|
||||||
|
pop: true
|
||||||
|
- match: '(\.)([A-Z][a-zA-Z0-9''_]*)'
|
||||||
|
scope: support.other.module.fsharp
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.module-reference.fsharp
|
||||||
|
2: support.other.module.fsharp
|
||||||
|
- match: '(?<!\w)([A-Z][a-zA-Z0-9_]*)(\.)'
|
||||||
|
captures:
|
||||||
|
1: support.other.module.fsharp
|
||||||
|
2: punctuation.separator.module-reference.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.module.reference.fsharp
|
||||||
|
- match: '[A-Z][a-zA-Z0-9_]+(\.)'
|
||||||
|
scope: support.other.module.fsharp
|
||||||
|
captures:
|
||||||
|
1: punctuation.separator.module-reference.fsharp
|
||||||
|
- match: (?=.)
|
||||||
|
pop: true
|
||||||
|
strings:
|
||||||
|
- match: '(?=[^\\])(""")'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.fsharp
|
||||||
|
- match: (""")
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.end.fsharp
|
||||||
|
pop: true
|
||||||
|
- match: '\\$[ \t]*'
|
||||||
|
scope: punctuation.separator.string.ignore-eol.fsharp
|
||||||
|
- match: '(?=[^\\])(@")'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.fsharp
|
||||||
|
- match: (")
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.end.fsharp
|
||||||
|
pop: true
|
||||||
|
- match: '\\$[ \t]*'
|
||||||
|
scope: punctuation.separator.string.ignore-eol.fsharp
|
||||||
|
- match: '(?=[^\\])(")'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.fsharp
|
||||||
|
- match: (")
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.end.fsharp
|
||||||
|
pop: true
|
||||||
|
- match: '\\$[ \t]*'
|
||||||
|
scope: punctuation.separator.string.ignore-eol.fsharp
|
||||||
|
- match: '\\([\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})'
|
||||||
|
scope: constant.character.string.escape.fsharp
|
||||||
|
- match: '\\(?![\\''ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).'
|
||||||
|
scope: invalid.illeagal.character.string.fsharp
|
||||||
|
- match: '(?=[^\\])('')'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.fsharp
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.fsharp
|
||||||
|
- match: (')
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.end.fsharp
|
||||||
|
pop: true
|
||||||
|
- match: '\\$[ \t]*'
|
||||||
|
scope: punctuation.separator.string.ignore-eol.fsharp
|
||||||
|
- match: '\\([\\"ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8})'
|
||||||
|
scope: constant.character.string.escape.fsharp
|
||||||
|
- match: '\\(?![\\"ntbr]|u[a-fA-F0-9]{4}|u[a-fA-F0-9]{8}).'
|
||||||
|
scope: invalid.illeagal.character.string.fsharp
|
||||||
|
structure:
|
||||||
|
- match: \(
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.paren-group.fsharp
|
||||||
|
- match: \)
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
variables:
|
||||||
|
- match: \(\)
|
||||||
|
scope: variable.parameter.unit.fsharp
|
||||||
|
- match: '[a-zA-Z]\w*'
|
||||||
|
scope: variable.parameter.fsharp
|
||||||
@@ -15,6 +15,8 @@ file_extensions:
|
|||||||
- url
|
- url
|
||||||
- URL
|
- URL
|
||||||
- .editorconfig
|
- .editorconfig
|
||||||
|
- .hgrc
|
||||||
|
- hgrc
|
||||||
scope: source.ini
|
scope: source.ini
|
||||||
contexts:
|
contexts:
|
||||||
main:
|
main:
|
||||||
|
|||||||
Submodule
+1
Submodule assets/syntaxes/JavaScript (Babel) added at a9a908fe1d
File diff suppressed because it is too large
Load Diff
Submodule
+1
Submodule assets/syntaxes/PowerShell added at 12b7d7257e
@@ -0,0 +1,466 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: PowerShell
|
||||||
|
file_extensions:
|
||||||
|
- ps1
|
||||||
|
- psm1
|
||||||
|
- psd1
|
||||||
|
scope: source.powershell
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: "<#"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.block.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.powershell
|
||||||
|
- match: "#>"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.block.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: commentEmbeddedDocs
|
||||||
|
- match: '[2-6]>&1|>>|>|<<|<|>|>\||[1-6]>|[1-6]>>'
|
||||||
|
scope: keyword.operator.redirection.powershell
|
||||||
|
- include: commands
|
||||||
|
- include: commentLine
|
||||||
|
- include: variable
|
||||||
|
- include: interpolatedStringContent
|
||||||
|
- include: function
|
||||||
|
- include: attribute
|
||||||
|
- include: UsingDirective
|
||||||
|
- include: type
|
||||||
|
- include: hashtable
|
||||||
|
- include: doubleQuotedString
|
||||||
|
- include: scriptblock
|
||||||
|
- include: doubleQuotedStringEscapes
|
||||||
|
- match: (?<!')'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.powershell
|
||||||
|
- match: "'(?!')"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.powershell
|
||||||
|
pop: true
|
||||||
|
- match: "''"
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
|
- match: \@"(?=$)
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.heredoc.powershell
|
||||||
|
- match: ^"@
|
||||||
|
pop: true
|
||||||
|
- include: variableNoProperty
|
||||||
|
- include: doubleQuotedStringEscapes
|
||||||
|
- include: interpolation
|
||||||
|
- match: \@'(?=$)
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.heredoc.powershell
|
||||||
|
- match: ^'@
|
||||||
|
pop: true
|
||||||
|
- match: "''"
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
|
- include: numericConstant
|
||||||
|
- match: (@)(\()
|
||||||
|
captures:
|
||||||
|
1: keyword.other.array.begin.powershell
|
||||||
|
2: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.group.array-expression.powershell
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: (\$)(\()
|
||||||
|
comment: "TODO: move to repo; make recursive."
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.group.complex.subexpression.powershell
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: '(\b(([A-Za-z0-9\-_\.]+)\.(?i:exe|com|cmd|bat))\b)'
|
||||||
|
scope: support.function.powershell
|
||||||
|
- match: (?<!\w|-|\.)((?i:begin|break|catch|continue|data|default|define|do|dynamicparam|else|elseif|end|exit|finally|for|from|if|in|inlinescript|parallel|param|process|return|sequence|switch|throw|trap|try|until|var|while)|%|\?)(?!\w)
|
||||||
|
scope: keyword.control.powershell
|
||||||
|
- match: '(?<!\w|-|[^\)]\.)((?i:(foreach|where)(?!-object))|%|\?)(?!\w)'
|
||||||
|
scope: keyword.control.powershell
|
||||||
|
- match: (?<!\w)(--%)(?!\w)
|
||||||
|
comment: This should be moved to the repository at some point.
|
||||||
|
captures:
|
||||||
|
1: keyword.control.powershell
|
||||||
|
push:
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: .+
|
||||||
|
scope: string.unquoted.powershell
|
||||||
|
- match: (?<!\w)((?i:hidden|static))(?!\w)
|
||||||
|
comment: This should only be relevant inside a class but will require a rework of how classes are matched. This is a temp fix.
|
||||||
|
scope: storage.modifier.powershell
|
||||||
|
- match: '(?<!\w|-)((?i:class)|%|\?)(?:\s)+((?:\p{L}|\d|_|-|)+)\b'
|
||||||
|
comment: capture should be entity.name.type, but it doesn't provide a good color in the default schema.
|
||||||
|
captures:
|
||||||
|
1: storage.type.powershell
|
||||||
|
2: entity.name.function
|
||||||
|
- match: (?<!\w)-(?i:is(?:not)?|as)\b
|
||||||
|
scope: keyword.operator.comparison.powershell
|
||||||
|
- match: '(?<!\w)-(?i:[ic]?(?:eq|ne|[gl][te]|(?:not)?(?:like|match|contains|in)|replace))(?!\p{L})'
|
||||||
|
scope: keyword.operator.comparison.powershell
|
||||||
|
- match: '(?<!\w)-(?i:join|split)(?!\p{L})|!'
|
||||||
|
scope: keyword.operator.unary.powershell
|
||||||
|
- match: '(?<!\w)-(?i:and|or|not|xor)(?!\p{L})|!'
|
||||||
|
scope: keyword.operator.logical.powershell
|
||||||
|
- match: '(?<!\w)-(?i:band|bor|bnot|bxor|shl|shr)(?!\p{L})'
|
||||||
|
scope: keyword.operator.bitwise.powershell
|
||||||
|
- match: '(?<!\w)-(?i:f)(?!\p{L})'
|
||||||
|
scope: keyword.operator.string-format.powershell
|
||||||
|
- match: "[+%*/-]?=|[+/*%-]"
|
||||||
|
scope: keyword.operator.assignment.powershell
|
||||||
|
- match: '\|{2}|&{2}|;'
|
||||||
|
scope: punctuation.terminator.statement.powershell
|
||||||
|
- match: '&|(?<!\w)\.(?= )|`|,|\|'
|
||||||
|
scope: keyword.operator.other.powershell
|
||||||
|
- match: (?<!\s|^)\.\.(?=\-?\d|\(|\$)
|
||||||
|
comment: This is very imprecise, is there a syntax for 'must come after...'
|
||||||
|
scope: keyword.operator.range.powershell
|
||||||
|
RequiresDirective:
|
||||||
|
- match: (?<=#)(?i:(requires))\s
|
||||||
|
captures:
|
||||||
|
0: keyword.control.requires.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.requires.powershell
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: \-(?i:Modules|PSSnapin|RunAsAdministrator|ShellId|Version)
|
||||||
|
scope: keyword.other.powershell
|
||||||
|
- match: '(?<!-)\b\p{L}+|\d+(?:\.\d+)*'
|
||||||
|
scope: variable.parameter.powershell
|
||||||
|
- include: hashtable
|
||||||
|
UsingDirective:
|
||||||
|
- match: (?<!\w)(?i:(using))\s+(?i:(namespace|module))\s+(?i:((?:\w+(?:\.)?)+))
|
||||||
|
captures:
|
||||||
|
1: keyword.control.using.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
3: variable.parameter.powershell
|
||||||
|
attribute:
|
||||||
|
- match: '(\[)\s*\b(?i)(cmdletbinding|alias|outputtype|parameter|validatenotnull|validatenotnullorempty|validatecount|validateset|allownull|allowemptycollection|allowemptystring|validatescript|validaterange|validatepattern|validatelength)\b'
|
||||||
|
captures:
|
||||||
|
1: punctuation.section.bracket.begin.powershell
|
||||||
|
2: support.function.attribute.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.attribute.powershell
|
||||||
|
- match: '(\])'
|
||||||
|
captures:
|
||||||
|
1: punctuation.section.bracket.end.powershell
|
||||||
|
pop: true
|
||||||
|
- match: \(
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: variable
|
||||||
|
- include: variableNoProperty
|
||||||
|
- include: hashtable
|
||||||
|
- include: scriptblock
|
||||||
|
- include: doubleQuotedStringEscapes
|
||||||
|
- include: doubleQuotedString
|
||||||
|
- include: type
|
||||||
|
- include: numericConstant
|
||||||
|
- include: doubleQuotedString
|
||||||
|
- include: main
|
||||||
|
- match: (?i)\b(mandatory|valuefrompipeline|valuefrompipelinebypropertyname|valuefromremainingarguments|position|parametersetname|defaultparametersetname|supportsshouldprocess|supportspaging|positionalbinding|helpuri|confirmimpact|helpmessage)\b(?:\s+)?(=)?
|
||||||
|
captures:
|
||||||
|
1: variable.parameter.attribute.powershell
|
||||||
|
2: keyword.operator.assignment.powershell
|
||||||
|
- match: (?<!')'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.single.powershell
|
||||||
|
- match: "'(?!')"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.powershell
|
||||||
|
pop: true
|
||||||
|
- match: "''"
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
|
commands:
|
||||||
|
- match: '(?:(\p{L}|\d|_|-|\\|\:)*\\)?\b(?i:Add|Approve|Assert|Backup|Block|Build|Checkpoint|Clear|Close|Compare|Complete|Compress|Confirm|Connect|Convert|ConvertFrom|ConvertTo|Copy|Debug|Deny|Deploy|Disable|Disconnect|Dismount|Edit|Enable|Enter|Exit|Expand|Export|Find|Format|Get|Grant|Group|Hide|Import|Initialize|Install|Invoke|Join|Limit|Lock|Measure|Merge|Mount|Move|New|Open|Optimize|Out|Ping|Pop|Protect|Publish|Push|Read|Receive|Redo|Register|Remove|Rename|Repair|Request|Reset|Resize|Resolve|Restart|Restore|Resume|Revoke|Save|Search|Select|Send|Set|Show|Skip|Split|Start|Step|Stop|Submit|Suspend|Switch|Sync|Test|Trace|Unblock|Undo|Uninstall|Unlock|Unprotect|Unpublish|Unregister|Update|Use|Wait|Watch|Write)\-.+?(?:\.(?i:exe|cmd|bat|ps1))?\b'
|
||||||
|
comment: "Verb-Noun pattern:"
|
||||||
|
scope: support.function.powershell
|
||||||
|
- match: (?<!\w)(?i:foreach-object)(?!\w)
|
||||||
|
comment: Builtin cmdlets with reserved verbs
|
||||||
|
scope: support.function.powershell
|
||||||
|
- match: (?<!\w)(?i:where-object)(?!\w)
|
||||||
|
comment: Builtin cmdlets with reserved verbs
|
||||||
|
scope: support.function.powershell
|
||||||
|
- match: (?<!\w)(?i:sort-object)(?!\w)
|
||||||
|
comment: Builtin cmdlets with reserved verbs
|
||||||
|
scope: support.function.powershell
|
||||||
|
- match: (?<!\w)(?i:tee-object)(?!\w)
|
||||||
|
comment: Builtin cmdlets with reserved verbs
|
||||||
|
scope: support.function.powershell
|
||||||
|
commentEmbeddedDocs:
|
||||||
|
- match: ^(?i:(?:\s?|#)+(\.)(COMPONENT|DESCRIPTION|EXAMPLE|EXTERNALHELP|FORWARDHELPCATEGORY|FORWARDHELPTARGETNAME|FUNCTIONALITY|INPUTS|LINK|NOTES|OUTPUTS|REMOTEHELPRUNSPACE|ROLE|SYNOPSIS))
|
||||||
|
scope: comment.documentation.embedded.powershell
|
||||||
|
captures:
|
||||||
|
1: constant.string.documentation.powershell
|
||||||
|
2: keyword.operator.documentation.powershell
|
||||||
|
- match: '(?i:\s?(\.)(PARAMETER|FORWARDHELPTARGETNAME|FORWARDHELPCATEGORY|REMOTEHELPRUNSPACE|EXTERNALHELP)\s+([a-z0-9-_]+))'
|
||||||
|
scope: comment.documentation.embedded.powershell
|
||||||
|
captures:
|
||||||
|
1: constant.string.documentation.powershell
|
||||||
|
2: keyword.operator.documentation.powershell
|
||||||
|
3: keyword.operator.documentation.powershell
|
||||||
|
commentLine:
|
||||||
|
- match: '(?<![`\\-])#'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.line.powershell
|
||||||
|
- match: $\n?
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.powershell
|
||||||
|
pop: true
|
||||||
|
- include: commentEmbeddedDocs
|
||||||
|
- include: RequiresDirective
|
||||||
|
doubleQuotedString:
|
||||||
|
- match: (?<!(?<!`)")"
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: string.quoted.double.powershell
|
||||||
|
- match: '"(?!")'
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.string.end.powershell
|
||||||
|
pop: true
|
||||||
|
- match: '(?i)\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,64}\b'
|
||||||
|
- include: variableNoProperty
|
||||||
|
- include: variable
|
||||||
|
- include: doubleQuotedStringEscapes
|
||||||
|
- include: interpolation
|
||||||
|
- match: '`\s*$'
|
||||||
|
scope: keyword.other.powershell
|
||||||
|
doubleQuotedStringEscapes:
|
||||||
|
- match: '`[0abnfrvt"''$`]'
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
|
- match: '""'
|
||||||
|
scope: constant.character.escape.powershell
|
||||||
|
function:
|
||||||
|
- match: '^(?:\s*+)(?i)(function|filter|configuration|workflow)\s+(?:(global|local|script|private):)?((?:\p{L}|\d|_|-|\.)+)'
|
||||||
|
captures:
|
||||||
|
0: meta.function.powershell
|
||||||
|
1: storage.type.powershell
|
||||||
|
2: storage.modifier.scope.powershell
|
||||||
|
3: entity.name.function.powershell
|
||||||
|
push:
|
||||||
|
- match: '(?=\{|\()'
|
||||||
|
pop: true
|
||||||
|
- include: commentLine
|
||||||
|
hashtable:
|
||||||
|
- match: '(@)(\{)'
|
||||||
|
captures:
|
||||||
|
1: keyword.other.hashtable.begin.powershell
|
||||||
|
2: punctuation.section.braces.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.hashtable.powershell
|
||||||
|
- match: '(\})'
|
||||||
|
captures:
|
||||||
|
1: punctuation.section.braces.end.powershell
|
||||||
|
pop: true
|
||||||
|
- match: \b((?:\'|\")?)(\w+)((?:\'|\")?)(?:\s+)?(=)(?:\s+)?
|
||||||
|
scope: meta.hashtable.assignment.powershell
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.string.begin.powershell
|
||||||
|
2: variable.other.readwrite.powershell
|
||||||
|
3: punctuation.definition.string.end.powershell
|
||||||
|
4: keyword.operator.assignment.powershell
|
||||||
|
- include: scriptblock
|
||||||
|
- include: main
|
||||||
|
interpolatedStringContent:
|
||||||
|
- match: \(
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_content_scope: interpolated.simple.source.powershell
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- include: interpolation
|
||||||
|
- include: interpolatedStringContent
|
||||||
|
interpolation:
|
||||||
|
- match: (\$)(\()
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: punctuation.section.group.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_content_scope: interpolated.complex.source.powershell
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.group.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- include: interpolation
|
||||||
|
- include: interpolatedStringContent
|
||||||
|
numericConstant:
|
||||||
|
- match: '(?<!\w)([-+]?0(?:x|X)[0-9a-fA-F_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.hex.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
- match: '(?<!\w)([-+]?(?:[0-9_]+)?\.[0-9_]+(?:(?:e|E)[0-9]+)?(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.integer.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
- match: '(?<!\w)([-+]?0(?:b|B)[01_]+(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.octal.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
- match: '(?<!\w)([-+]?[0-9_]+(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.integer.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
- match: '(?<!\w)([-+]?[0-9_]+\.(?:e|E)(?:[0-9_])?+(?:F|f|D|d|M|m)?)((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.integer.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
- match: '(?<!\w)([-+]?[0-9_]+[\.]?(?:F|f|D|d|M|m))((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.integer.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
- match: '(?<!\w)([-+]?[0-9_]+[\.]?(?:U|u|L|l|UL|Ul|uL|ul|LU|Lu|lU|lu)?)((?i:[kmgtp]b)?)\b'
|
||||||
|
captures:
|
||||||
|
1: constant.numeric.integer.powershell
|
||||||
|
2: keyword.other.powershell
|
||||||
|
scriptblock:
|
||||||
|
- match: '\{'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.braces.begin.powershell
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.scriptblock.powershell
|
||||||
|
- match: '\}'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.braces.end.powershell
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
type:
|
||||||
|
- match: '\['
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.bracket.begin.powershell
|
||||||
|
push:
|
||||||
|
- match: '\]'
|
||||||
|
captures:
|
||||||
|
0: punctuation.section.bracket.end.powershell
|
||||||
|
pop: true
|
||||||
|
- match: '(?!\d+|\.)(?:\p{L}|\p{N}|\.)+'
|
||||||
|
scope: storage.type.powershell
|
||||||
|
- include: main
|
||||||
|
variable:
|
||||||
|
- match: (\$)(?i:(False|Null|True))\b
|
||||||
|
comment: These are special constants.
|
||||||
|
captures:
|
||||||
|
0: constant.language.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
- match: '(\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))((?:\.(?:\p{L}|\d|_)+)*\b)?\b'
|
||||||
|
comment: These are the other built-in constants.
|
||||||
|
captures:
|
||||||
|
0: support.constant.variable.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
3: variable.other.member.powershell
|
||||||
|
- match: '(\$)(?i:(\$|\^|\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))((?:\.(?:\p{L}|\d|_)+)*\b)?\b'
|
||||||
|
comment: Automatic variables are not constants, but they are read-only. In monokai (default) color schema support.variable doesn't have color, so we use constant.
|
||||||
|
captures:
|
||||||
|
0: support.constant.automatic.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
3: variable.other.member.powershell
|
||||||
|
- match: '(\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))((?:\.(?:\p{L}|\d|_)+)*\b)?\b'
|
||||||
|
comment: Style preference variables as language variables so that they stand out.
|
||||||
|
captures:
|
||||||
|
0: variable.language.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
3: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))((?:\.(?:\p{L}|\d|_)+)*\b)?'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: storage.modifier.scope.powershell
|
||||||
|
4: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_)+)*\b)?'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: punctuation.section.braces.begin.powershell
|
||||||
|
3: storage.modifier.scope.powershell
|
||||||
|
5: punctuation.section.braces.end.powershell
|
||||||
|
6: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$|@)((?:\p{L}|\d|_)+:)?((?:\p{L}|\d|_)+))((?:\.(?:\p{L}|\d|_)+)*\b)?'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: support.variable.drive.powershell
|
||||||
|
4: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$)(\{)((?:\p{L}|\d|_)+:)?([^}]*[^}`])(\}))((?:\.(?:\p{L}|\d|_)+)*\b)?'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: punctuation.section.braces.begin.powershell
|
||||||
|
3: support.variable.drive.powershell
|
||||||
|
5: punctuation.section.braces.end.powershell
|
||||||
|
6: variable.other.member.powershell
|
||||||
|
variableNoProperty:
|
||||||
|
- match: (\$)(?i:(False|Null|True))\b
|
||||||
|
comment: These are special constants.
|
||||||
|
captures:
|
||||||
|
0: constant.language.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
- match: (\$)(?i:(Error|ExecutionContext|Host|Home|PID|PsHome|PsVersionTable|ShellID))\b
|
||||||
|
comment: These are the other built-in constants.
|
||||||
|
captures:
|
||||||
|
0: support.constant.variable.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
3: variable.other.member.powershell
|
||||||
|
- match: (\$)(?i:(\$|\^|\?|_|Args|ConsoleFileName|Event|EventArgs|EventSubscriber|ForEach|Input|LastExitCode|Matches|MyInvocation|NestedPromptLevel|Profile|PSBoundParameters|PsCmdlet|PsCulture|PSDebugContext|PSItem|PSCommandPath|PSScriptRoot|PsUICulture|Pwd|Sender|SourceArgs|SourceEventArgs|StackTrace|Switch|This))\b
|
||||||
|
comment: Automatic variables are not constants, but they are read-only...
|
||||||
|
captures:
|
||||||
|
0: support.variable.automatic.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
3: variable.other.member.powershell
|
||||||
|
- match: (\$)(?i:(ConfirmPreference|DebugPreference|ErrorActionPreference|ErrorView|FormatEnumerationLimit|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount|MaximumHistoryCount|MaximumVariableCount|OFS|OutputEncoding|ProgressPreference|PsCulture|PSDebugContext|PSDefaultParameterValues|PSEmailServer|PSItem|PSModuleAutoloadingPreference|PSSenderInfo|PSSessionApplicationName|PSSessionConfigurationName|PSSessionOption|VerbosePreference|WarningPreference|WhatIfPreference))\b
|
||||||
|
comment: Style preference variables as language variables so that they stand out.
|
||||||
|
captures:
|
||||||
|
0: variable.language.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
3: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$|@)(global|local|private|script|using|workflow):((?:\p{L}|\d|_)+))'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: storage.modifier.scope.powershell
|
||||||
|
4: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$)(\{)(global|local|private|script|using|workflow):([^}]*[^}`])(\}))'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: storage.modifier.scope.powershell
|
||||||
|
4: keyword.other.powershell
|
||||||
|
5: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$)((?:\p{L}|\d|_)+:)?((?:\p{L}|\d|_)+))'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: support.variable.drive.powershell
|
||||||
|
4: variable.other.member.powershell
|
||||||
|
- match: '(?i:(\$)(\{)((?:\p{L}|\d|_)+:)?([^}]*[^}`])(\}))'
|
||||||
|
captures:
|
||||||
|
0: variable.other.readwrite.powershell
|
||||||
|
1: punctuation.definition.variable.powershell
|
||||||
|
2: punctuation.section.braces.begin
|
||||||
|
3: support.variable.drive.powershell
|
||||||
|
5: punctuation.section.braces.end
|
||||||
Submodule
+1
Submodule assets/syntaxes/PureScript added at 42a61e39ad
Submodule
+1
Submodule assets/syntaxes/Robot added at 8e5a349a3e
@@ -0,0 +1,54 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Robot Framework syntax highlighting.
|
||||||
|
file_extensions:
|
||||||
|
- robot
|
||||||
|
scope: source.robot
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- match: '\$\{(\d+|\d+\.\d*|0[bB][01]+|0[oO][0-7]+|0[xX][0-9a-fA-F]+)\}'
|
||||||
|
comment: "Robot Framework numbers, like ${1} or ${12.3}"
|
||||||
|
scope: constant.numeric.robot
|
||||||
|
- match: '(?i)(%\{[\w|\s]+\})'
|
||||||
|
comment: "Robot Framework environment variable, like %{USER}"
|
||||||
|
scope: variable.parameter.robot
|
||||||
|
- match: '((?<!\\)|(?<=\\\\))[$&]{'
|
||||||
|
comment: Robot Framework scalar and dictionary variables
|
||||||
|
push:
|
||||||
|
- meta_scope: entity.name.class
|
||||||
|
- match: '\}'
|
||||||
|
pop: true
|
||||||
|
- match: '((?<!\\)(@{)|(?<=\\\\)(@{))'
|
||||||
|
comment: Robot Framework list variables
|
||||||
|
push:
|
||||||
|
- meta_scope: entity.name.class
|
||||||
|
- match: '(}\[.+])|(})'
|
||||||
|
pop: true
|
||||||
|
- match: '(?i)^(\|\s*)?(\*{1,3} ?)(settings?|variables?|keywords?|test cases?)( ?\*{1,3})?(\s*\|)?'
|
||||||
|
comment: Robot Framework data tables
|
||||||
|
scope: string.robot.header
|
||||||
|
- match: '(?i)(^\|\s*)?\[?Documentation\]?\s+'
|
||||||
|
comment: Test case, keyword and settings table documentation
|
||||||
|
push:
|
||||||
|
- meta_scope: comment
|
||||||
|
- match: ^(?!\s*+\.\.\.)
|
||||||
|
pop: true
|
||||||
|
- match: '(^| {2,}|\t|\\| {1,})(?<!\\\\)#'
|
||||||
|
comment: Comment character
|
||||||
|
push:
|
||||||
|
- meta_scope: comment
|
||||||
|
- match: $
|
||||||
|
pop: true
|
||||||
|
- match: '(?i)\s+\[(Tags|Setup|Teardown|Template|Timeout|Arguments|Return)\]'
|
||||||
|
comment: Tests case and keyword settings
|
||||||
|
scope: storage.type
|
||||||
|
- match: (?i)^(\|\s*)?(Library|Resource|Test Timeout|Test Template|Test Teardown|Test Setup|Default Tags|Force Tags|Metadata|Variables|Suite Setup|Suite Teardown)(?:( )|( \| ))
|
||||||
|
comment: Settings table settings, like Library
|
||||||
|
scope: constant.language
|
||||||
|
- match: '^(\|\s+)?(?!^\.{3})(?![\|$&])\S+'
|
||||||
|
comment: Keywords and test cases
|
||||||
|
push:
|
||||||
|
- meta_scope: keyword.control.robot
|
||||||
|
- match: '($|\||\s{2,})'
|
||||||
|
pop: true
|
||||||
Submodule
+1
Submodule assets/syntaxes/Swift added at fef17119ce
@@ -0,0 +1,371 @@
|
|||||||
|
%YAML 1.2
|
||||||
|
---
|
||||||
|
# http://www.sublimetext.com/docs/3/syntax.html
|
||||||
|
name: Swift
|
||||||
|
file_extensions:
|
||||||
|
- swift
|
||||||
|
first_line_match: ^#!/.*\bswift
|
||||||
|
scope: source.swift
|
||||||
|
contexts:
|
||||||
|
main:
|
||||||
|
- include: shebang-line
|
||||||
|
- include: comment
|
||||||
|
- include: attribute
|
||||||
|
- include: literal
|
||||||
|
- include: operator
|
||||||
|
- include: declaration
|
||||||
|
- include: storage-type
|
||||||
|
- include: keyword
|
||||||
|
- include: type
|
||||||
|
- include: boolean
|
||||||
|
comment:
|
||||||
|
- include: documentation-comment
|
||||||
|
- include: block-comment
|
||||||
|
- include: in-line-comment
|
||||||
|
access-level-modifier:
|
||||||
|
- match: \b(open|public|internal|fileprivate|private)\b(?:\(set\))?
|
||||||
|
comment: access-level-modifier
|
||||||
|
scope: keyword.other.access-level-modifier.swift
|
||||||
|
arithmetic-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])(\+|\-|\*|\/)(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.arithmetic.swift
|
||||||
|
array-type:
|
||||||
|
- match: \b(Array)(<)
|
||||||
|
captures:
|
||||||
|
1: support.type.array.swift
|
||||||
|
2: punctuation.array.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.array.swift
|
||||||
|
- match: (>)
|
||||||
|
captures:
|
||||||
|
1: punctuation.array.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
assignment-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])(\+|\-|\*|\/|%|<<|>>|&|\^|\||&&|\|\|)?=(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.assignment.swift
|
||||||
|
attribute:
|
||||||
|
- match: '((@)(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B))(\()'
|
||||||
|
captures:
|
||||||
|
1: storage.modifier.attribute.swift
|
||||||
|
2: punctuation.definition.attribute.swift
|
||||||
|
3: punctuation.definition.attribute-arguments.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_content_scope: meta.attribute.arguments.swift
|
||||||
|
- match: \)
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.attribute-arguments.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
- match: '((@)(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B))'
|
||||||
|
captures:
|
||||||
|
1: storage.modifier.attribute.swift
|
||||||
|
2: punctuation.definition.attribute.swift
|
||||||
|
bitwise-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])(&|\||\^|<<|>>)(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.bitwise.swift
|
||||||
|
block-comment:
|
||||||
|
- match: /\*
|
||||||
|
comment: Block comment
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.block.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.swift
|
||||||
|
- match: \*/
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.block.end.swift
|
||||||
|
pop: true
|
||||||
|
boolean:
|
||||||
|
- match: \b(true|false)\b
|
||||||
|
scope: keyword.constant.boolean.swift
|
||||||
|
branch-statement-keyword:
|
||||||
|
- include: if-statement-keyword
|
||||||
|
- include: switch-statement-keyword
|
||||||
|
catch-statement-keyword:
|
||||||
|
- match: \b(catch|do)\b
|
||||||
|
comment: catch-statement
|
||||||
|
scope: kewyord.control.catch.swift
|
||||||
|
code-block:
|
||||||
|
- match: '(\{)'
|
||||||
|
comment: code-block
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.code-block.begin.swift
|
||||||
|
push:
|
||||||
|
- match: '(\})'
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.code-block.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
collection-type:
|
||||||
|
- include: array-type
|
||||||
|
- include: dictionary-type
|
||||||
|
- match: \b(Array|Dictionary)\b
|
||||||
|
scope: support.type.swift
|
||||||
|
comparative-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])((=|!)==?|(<|>)=?|~=)(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.comparative.swift
|
||||||
|
control-transfer-statement-keyword:
|
||||||
|
- match: \b(continue|break|fallthrough|return)\b
|
||||||
|
comment: control-transfer-statement
|
||||||
|
scope: keyword.control.transfer.swift
|
||||||
|
custom-operator:
|
||||||
|
- match: '(?<=[\s(\[{,;:])([/=\-+!*%<>&|\^~.]++)(?![\s)\]},;:])'
|
||||||
|
scope: keyword.operator.custom.prefix.unary.swift
|
||||||
|
- match: '(?<![\s(\[{,;:])([/=\-+!*%<>&|\^~.]++)(?![\s)\]},;:\.])'
|
||||||
|
scope: keyword.operator.custom.postfix.unary.swift
|
||||||
|
- match: '(?<=[\s(\[{,;:])([/=\-+!*%<>&|\^~.]++)(?=[\s)\]},;:])'
|
||||||
|
scope: keyword.operator.custom.binary.swift
|
||||||
|
declaration:
|
||||||
|
- include: import-declaration
|
||||||
|
- include: function-declaration
|
||||||
|
declaration-modifier:
|
||||||
|
- match: \b(class|convenience|dynamic|final|lazy|(non)?mutating|optional|override|required|static|unowned((un)?safe)?|weak)\b
|
||||||
|
comment: declaration-modifier
|
||||||
|
scope: keyword.other.declaration-modifier.swift
|
||||||
|
dictionary-type:
|
||||||
|
- match: \b(Dictionary)(<)
|
||||||
|
captures:
|
||||||
|
1: support.type.dictionary.swift
|
||||||
|
2: punctuation.dictionary.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.dictionary.swift
|
||||||
|
- match: (>)
|
||||||
|
captures:
|
||||||
|
1: punctuation.dictionary.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
documentation-comment:
|
||||||
|
- match: /\*\*
|
||||||
|
comment: Documentation comment
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.block.documentation.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: comment.block.documentation.swift
|
||||||
|
- match: \*/
|
||||||
|
captures:
|
||||||
|
0: punctuation.definition.comment.block.documentation.end.swift
|
||||||
|
pop: true
|
||||||
|
floating-point-literal:
|
||||||
|
- match: '\b([0-9][0-9_]*)(\.([0-9][0-9_]*))?([eE][+\-]?([0-9][0-9_]*))?\b'
|
||||||
|
comment: floating-point-literal -> (decimal-literal)(decimal-fraction)?(decimal-exponent)?
|
||||||
|
- match: '\b(0x\h[\h_]*)(\.(0x\h[\h_]*))?([pP][+\-]?(0x\h[\h_]*))\b'
|
||||||
|
comment: floating-point-literal -> (hexadecimal-literal)(hexadecimal-fraction)?(hexadecimal-exponent)
|
||||||
|
function-body:
|
||||||
|
- include: code-block
|
||||||
|
function-declaration:
|
||||||
|
- match: '\b(func)\s+(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B|[/=\-+!*%<>&|\^~.]+)\s*(?=\(|<)'
|
||||||
|
comment: function-declaration
|
||||||
|
captures:
|
||||||
|
1: storage.type.function.swift
|
||||||
|
2: entity.type.function.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-declaration.swift
|
||||||
|
- match: '(?<=\})'
|
||||||
|
pop: true
|
||||||
|
- include: generic-parameter-clause
|
||||||
|
- include: parameter-clause
|
||||||
|
- include: function-result
|
||||||
|
- include: function-body
|
||||||
|
function-result:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])(\->)(?![/=\-+!*%<>&|\^~.])\s*'
|
||||||
|
comment: function-result
|
||||||
|
captures:
|
||||||
|
1: keyword.operator.function-result.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.function-result.swift
|
||||||
|
- match: '\s*(?=\{)'
|
||||||
|
pop: true
|
||||||
|
- include: type
|
||||||
|
generic-parameter-clause:
|
||||||
|
- match: (<)
|
||||||
|
comment: generic-parameter-clause
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.generic-parameter-clause.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.generic-parameter-clause.swift
|
||||||
|
- match: (>)
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.generic-parameter-clause.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
identifier:
|
||||||
|
- match: '(\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B)'
|
||||||
|
comment: identifier
|
||||||
|
scope: meta.identifier.swift
|
||||||
|
if-statement-keyword:
|
||||||
|
- match: \b(if|else)\b
|
||||||
|
comment: if-statement
|
||||||
|
scope: keyword.control.if.swift
|
||||||
|
import-declaration:
|
||||||
|
- match: '\b(import)\s+(?:(typealias|struct|class|enum|protocol|var|func)\s+)?((?:\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B|[/=\-+!*%<>&|\^~.]+)(?:\.(?:\B\$[0-9]+|\b[\w^\d][\w\d]*\b|\B`[\w^\d][\w\d]*`\B|[/=\-+!*%<>&|\^~.]+))*)'
|
||||||
|
comment: import-declaration
|
||||||
|
scope: meta.import.swift
|
||||||
|
captures:
|
||||||
|
1: keyword.other.import.swift
|
||||||
|
2: storage.modifier.swift
|
||||||
|
3: support.type.module.import.swift
|
||||||
|
in-line-comment:
|
||||||
|
- match: (//).*
|
||||||
|
comment: In-line comment
|
||||||
|
scope: comment.line.double-slash.swift
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.line.double-slash.swift
|
||||||
|
increment-decrement-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])(\+\+|\-\-)(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.increment-or-decrement.swift
|
||||||
|
integer-literal:
|
||||||
|
- match: '(\B\-|\b)(0b[01][01_]*)\b'
|
||||||
|
comment: binary-literal
|
||||||
|
scope: constant.numeric.integer.binary.swift
|
||||||
|
- match: '(\B\-|\b)(0o[0-7][0-7_]*)\b'
|
||||||
|
comment: octal-literal
|
||||||
|
scope: constant.numeric.integer.octal.swift
|
||||||
|
- match: '(\B\-|\b)([0-9][0-9_]*)\b'
|
||||||
|
comment: decimal-literal
|
||||||
|
scope: constant.numeric.integer.decimal.swift
|
||||||
|
- match: '(\B\-|\b)(0x\h[\h_]*)\b'
|
||||||
|
comment: hexadecimal-literal
|
||||||
|
scope: constant.numeric.integer.hexadecimal.swift
|
||||||
|
integer-type:
|
||||||
|
- match: \bU?Int(8|16|32|64)?\b
|
||||||
|
comment: Int types
|
||||||
|
scope: support.type.swift
|
||||||
|
keyword:
|
||||||
|
- include: branch-statement-keyword
|
||||||
|
- include: control-transfer-statement-keyword
|
||||||
|
- include: loop-statement-keyword
|
||||||
|
- include: catch-statement-keyword
|
||||||
|
- include: operator-declaration-modifier
|
||||||
|
- include: declaration-modifier
|
||||||
|
- include: access-level-modifier
|
||||||
|
- match: \b(class|deinit|enum|extension|func|import|init|let|protocol|static|struct|subscript|typealias|var|throws|rethrows)\b
|
||||||
|
comment: declaration keyword
|
||||||
|
scope: keyword.declaration.swift
|
||||||
|
- match: \b(break|case|continue|default|do|else|fallthrough|if|in|for|return|switch|where|while|repeat|catch|guard|defer|try|throw)\b
|
||||||
|
comment: statement keyword
|
||||||
|
scope: keyword.statement.swift
|
||||||
|
- match: \b(as|dynamicType|is|new|super|self|Self|Type)\b
|
||||||
|
comment: expression and type keyword
|
||||||
|
scope: keyword.other.statement.swift
|
||||||
|
- match: \b(associativity|didSet|get|infix|inout|left|mutating|none|nonmutating|operator|override|postfix|precedence|prefix|right|set|unowned((un)?safe)?|weak|willSet)\b
|
||||||
|
comment: other keyword
|
||||||
|
scope: keyword.other.swift
|
||||||
|
literal:
|
||||||
|
- include: integer-literal
|
||||||
|
- include: floating-point-literal
|
||||||
|
- include: nil-literal
|
||||||
|
- include: string-literal
|
||||||
|
- include: special-literal
|
||||||
|
logical-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])(!|&&|\|\|)(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.logical.swift
|
||||||
|
loop-statement-keyword:
|
||||||
|
- match: \b(while|repeat|for|in)\b
|
||||||
|
comment: loop-statement
|
||||||
|
scope: keyword.control.loop.swift
|
||||||
|
nil-literal:
|
||||||
|
- match: \bnil\b
|
||||||
|
comment: nil-literal
|
||||||
|
scope: constant.nil.swift
|
||||||
|
operator:
|
||||||
|
- include: comparative-operator
|
||||||
|
- include: assignment-operator
|
||||||
|
- include: logical-operator
|
||||||
|
- include: remainder-operator
|
||||||
|
- include: increment-decrement-operator
|
||||||
|
- include: overflow-operator
|
||||||
|
- include: range-operator
|
||||||
|
- include: bitwise-operator
|
||||||
|
- include: arithmetic-operator
|
||||||
|
- include: ternary-operator
|
||||||
|
- include: type-casting-operator
|
||||||
|
- include: custom-operator
|
||||||
|
operator-declaration-modifier:
|
||||||
|
- match: \b(operator|prefix|infix|postfix)\b
|
||||||
|
comment: operator-declaration
|
||||||
|
scope: keyword.other.operator.swift
|
||||||
|
optional-type:
|
||||||
|
- match: \b(Optional)(<)
|
||||||
|
scope: meta.optional.swift
|
||||||
|
overflow-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])\&(\+|\-|\*|\/|%)(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.overflow.swift
|
||||||
|
parameter-clause:
|
||||||
|
- match: (\()
|
||||||
|
comment: parameter-clause
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.function-arguments.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.parameter-clause.swift
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.function-arguments.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: main
|
||||||
|
primitive-type:
|
||||||
|
- match: \b(Int|Float|Double|String|Bool|Character|Void)\b
|
||||||
|
comment: Primitive types
|
||||||
|
scope: support.type.swift
|
||||||
|
protocol-composition-type:
|
||||||
|
- match: \b(protocol)(<)
|
||||||
|
scope: meta.protocol.swift
|
||||||
|
range-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])\.\.(?:\.)?(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.range.swift
|
||||||
|
remainder-operator:
|
||||||
|
- match: '(?<![/=\-+!*%<>&|\^~.])\%(?![/=\-+!*%<>&|\^~.])'
|
||||||
|
scope: keyword.operator.remainder.swift
|
||||||
|
shebang-line:
|
||||||
|
- match: ^(#!).*$
|
||||||
|
comment: Shebang line
|
||||||
|
scope: comment.line.shebang.swift
|
||||||
|
captures:
|
||||||
|
1: punctuation.definition.comment.line.shebang.swift
|
||||||
|
special-literal:
|
||||||
|
- match: \b__(FILE|LINE|COLUMN|FUNCTION)__\b
|
||||||
|
scope: keyword.other.literal.swift
|
||||||
|
storage-type:
|
||||||
|
- match: \b(var|func|let|class|enum|struct|protocol|extension|typealias)\b
|
||||||
|
scope: storage.type.swift
|
||||||
|
string-literal:
|
||||||
|
- match: \"
|
||||||
|
captures:
|
||||||
|
0: string.quoted.double.swift
|
||||||
|
push:
|
||||||
|
- meta_scope: meta.literal.string.swift
|
||||||
|
- match: \"
|
||||||
|
captures:
|
||||||
|
0: string.quoted.double.swift
|
||||||
|
pop: true
|
||||||
|
- match: '\\([0tnr\"\''\\]|x\h{2}|u\h{4}|U\h{8})'
|
||||||
|
scope: constant.character.escape.swift
|
||||||
|
- match: (\\\()
|
||||||
|
captures:
|
||||||
|
1: support.punctuation.expression.begin.swift
|
||||||
|
push:
|
||||||
|
- meta_content_scope: meta.expression.swift
|
||||||
|
- match: (\))
|
||||||
|
captures:
|
||||||
|
1: support.punctuation.expression.end.swift
|
||||||
|
pop: true
|
||||||
|
- include: scope:source.swift
|
||||||
|
- match: (\"|\\)
|
||||||
|
scope: invalid.illegal.swift
|
||||||
|
- match: (.)
|
||||||
|
scope: string.quoted.double.swift
|
||||||
|
switch-statement-keyword:
|
||||||
|
- match: \b(switch|case|default|where)\b
|
||||||
|
comment: switch-statement
|
||||||
|
scope: keyword.control.switch.swift
|
||||||
|
ternary-operator:
|
||||||
|
- match: '(?<=[\s(\[{,;:])(\?|:)(?=[\s)\]},;:])'
|
||||||
|
scope: keyword.operator.ternary.swift
|
||||||
|
type:
|
||||||
|
- include: primitive-type
|
||||||
|
- include: integer-type
|
||||||
|
- include: collection-type
|
||||||
|
- include: optional-type
|
||||||
|
- include: protocol-composition-type
|
||||||
|
type-casting-operator:
|
||||||
|
- match: \b(is\b|as(\?\B|\b))
|
||||||
|
scope: keyword.operator.type-casting.swift
|
||||||
File diff suppressed because it is too large
Load Diff
+1
-1
Submodule assets/syntaxes/VimL updated: b453aff6f7...ed40c3bc81
@@ -63,7 +63,7 @@ contexts:
|
|||||||
- match: \b(if|while|for|try|return|throw|end(if|for|while|try)?|au(g|group)|else(if|)?|do|in|catch|finally|:)\b
|
- match: \b(if|while|for|try|return|throw|end(if|for|while|try)?|au(g|group)|else(if|)?|do|in|catch|finally|:)\b
|
||||||
scope: keyword.control.viml
|
scope: keyword.control.viml
|
||||||
number_hex:
|
number_hex:
|
||||||
- match: "#[0-9a-f]{6}"
|
- match: "0x[0-9a-f]+"
|
||||||
scope: constant.numeric.hex
|
scope: constant.numeric.hex
|
||||||
number_int:
|
number_int:
|
||||||
- match: '-?\d+'
|
- match: '-?\d+'
|
||||||
|
|||||||
Binary file not shown.
Submodule
+1
Submodule assets/themes/onehalf added at 2516b37c3f
@@ -0,0 +1,26 @@
|
|||||||
|
#[macro_use]
|
||||||
|
extern crate clap;
|
||||||
|
|
||||||
|
use clap::Shell;
|
||||||
|
use std::fs;
|
||||||
|
|
||||||
|
include!("src/clap_app.rs");
|
||||||
|
|
||||||
|
const BIN_NAME: &str = "bat";
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let outdir = std::env::var_os("SHELL_COMPLETIONS_DIR").or(std::env::var_os("OUT_DIR"));
|
||||||
|
|
||||||
|
let outdir = match outdir {
|
||||||
|
None => return,
|
||||||
|
Some(outdir) => outdir,
|
||||||
|
};
|
||||||
|
|
||||||
|
fs::create_dir_all(&outdir).unwrap();
|
||||||
|
|
||||||
|
let mut app = build_app(true);
|
||||||
|
app.gen_completions(BIN_NAME, Shell::Bash, &outdir);
|
||||||
|
app.gen_completions(BIN_NAME, Shell::Fish, &outdir);
|
||||||
|
app.gen_completions(BIN_NAME, Shell::Zsh, &outdir);
|
||||||
|
app.gen_completions(BIN_NAME, Shell::PowerShell, &outdir);
|
||||||
|
}
|
||||||
+20
-1
@@ -19,12 +19,15 @@ pack() {
|
|||||||
|
|
||||||
if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then
|
if [[ $TARGET == "arm-unknown-linux-gnueabihf" ]]; then
|
||||||
gcc_prefix="arm-linux-gnueabihf-"
|
gcc_prefix="arm-linux-gnueabihf-"
|
||||||
|
elif [[ $TARGET == "aarch64-unknown-linux-gnu" ]]; then
|
||||||
|
gcc_prefix="aarch64-linux-gnu-"
|
||||||
else
|
else
|
||||||
gcc_prefix=""
|
gcc_prefix=""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# create a "staging" directory
|
# create a "staging" directory
|
||||||
mkdir "$tempdir/$package_name"
|
mkdir "$tempdir/$package_name"
|
||||||
|
mkdir "$tempdir/$package_name/autocomplete"
|
||||||
|
|
||||||
# copying the main binary
|
# copying the main binary
|
||||||
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
cp "target/$TARGET/release/$PROJECT_NAME" "$tempdir/$package_name/"
|
||||||
@@ -36,6 +39,11 @@ pack() {
|
|||||||
cp LICENSE-MIT "$tempdir/$package_name"
|
cp LICENSE-MIT "$tempdir/$package_name"
|
||||||
cp LICENSE-APACHE "$tempdir/$package_name"
|
cp LICENSE-APACHE "$tempdir/$package_name"
|
||||||
|
|
||||||
|
# various autocomplete
|
||||||
|
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".bash "$tempdir/$package_name/autocomplete/${PROJECT_NAME}.bash-completion"
|
||||||
|
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/"$PROJECT_NAME".fish "$tempdir/$package_name/autocomplete"
|
||||||
|
cp target/"$TARGET"/release/build/"$PROJECT_NAME"-*/out/_"$PROJECT_NAME" "$tempdir/$package_name/autocomplete"
|
||||||
|
|
||||||
# archiving
|
# archiving
|
||||||
pushd "$tempdir"
|
pushd "$tempdir"
|
||||||
tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
|
tar czf "$out_dir/$package_name.tar.gz" "$package_name"/*
|
||||||
@@ -49,13 +57,24 @@ make_deb() {
|
|||||||
local version
|
local version
|
||||||
local dpkgname
|
local dpkgname
|
||||||
local conflictname
|
local conflictname
|
||||||
|
local gcc_prefix
|
||||||
|
|
||||||
case $TARGET in
|
case $TARGET in
|
||||||
x86_64*)
|
x86_64*)
|
||||||
architecture=amd64
|
architecture=amd64
|
||||||
|
gcc_prefix=""
|
||||||
;;
|
;;
|
||||||
i686*)
|
i686*)
|
||||||
architecture=i386
|
architecture=i386
|
||||||
|
gcc_prefix=""
|
||||||
|
;;
|
||||||
|
aarch64*)
|
||||||
|
architecture=arm64
|
||||||
|
gcc_prefix="aarch64-linux-gnu-"
|
||||||
|
;;
|
||||||
|
arm*hf)
|
||||||
|
architecture=armhf
|
||||||
|
gcc_prefix="arm-linux-gnueabihf-"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "make_deb: skipping target '${TARGET}'" >&2
|
echo "make_deb: skipping target '${TARGET}'" >&2
|
||||||
@@ -75,7 +94,7 @@ make_deb() {
|
|||||||
|
|
||||||
# copy the main binary
|
# copy the main binary
|
||||||
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
|
install -Dm755 "target/$TARGET/release/$PROJECT_NAME" "$tempdir/usr/bin/$PROJECT_NAME"
|
||||||
strip "$tempdir/usr/bin/$PROJECT_NAME"
|
"${gcc_prefix}"strip "$tempdir/usr/bin/$PROJECT_NAME"
|
||||||
|
|
||||||
# manpage
|
# manpage
|
||||||
install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
install -Dm644 "doc/$PROJECT_NAME.1" "$tempdir/usr/share/man/man1/$PROJECT_NAME.1"
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
# This script takes care of packaging the build artifacts that will go in the
|
||||||
|
# release zipfile
|
||||||
|
|
||||||
|
$SRC_DIR = $PWD.Path
|
||||||
|
$STAGE = [System.Guid]::NewGuid().ToString()
|
||||||
|
|
||||||
|
Set-Location $ENV:Temp
|
||||||
|
New-Item -Type Directory -Name $STAGE
|
||||||
|
Set-Location $STAGE
|
||||||
|
|
||||||
|
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip"
|
||||||
|
|
||||||
|
Copy-Item "$SRC_DIR\target\release\bat.exe" '.\'
|
||||||
|
Copy-Item $SRC_DIR\target\release\build\bat-*\out\_bat.ps1 '.\'
|
||||||
|
|
||||||
|
# readme and license
|
||||||
|
Copy-Item $SRC_DIR\README.md '.\'
|
||||||
|
Copy-Item $SRC_DIR\LICENSE-MIT '.\'
|
||||||
|
Copy-Item $SRC_DIR\LICENSE-APACHE '.\'
|
||||||
|
|
||||||
|
7z a "$ZIP" *
|
||||||
|
|
||||||
|
Push-AppveyorArtifact "$ZIP"
|
||||||
|
|
||||||
|
Set-Location ..
|
||||||
|
Remove-Item $STAGE -Force -Recurse
|
||||||
|
Set-Location $SRC_DIR
|
||||||
@@ -27,3 +27,11 @@ if [[ $TARGET == arm-unknown-linux-gnueabihf ]]; then
|
|||||||
libc6-armhf-cross \
|
libc6-armhf-cross \
|
||||||
libc6-dev-armhf-cross
|
libc6-dev-armhf-cross
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# needed for cross-compiling for arm64
|
||||||
|
if [[ $TARGET == aarch64-unknown-linux-gnu ]]; then
|
||||||
|
sudo apt-get install -y \
|
||||||
|
gcc-4.8-aarch64-linux-gnu \
|
||||||
|
binutils-aarch64-linux-gnu \
|
||||||
|
gcc-aarch64-linux-gnu
|
||||||
|
fi
|
||||||
|
|||||||
+1
-1
@@ -6,7 +6,7 @@ set -ex
|
|||||||
cargo build --target "$TARGET" --verbose
|
cargo build --target "$TARGET" --verbose
|
||||||
|
|
||||||
# We cannot run arm executables on linux
|
# We cannot run arm executables on linux
|
||||||
if [[ $TARGET != arm-unknown-linux-gnueabihf ]]; then
|
if [[ $TARGET != arm-unknown-linux-gnueabihf ]] && [[ $TARGET != aarch64-unknown-linux-gnu ]]; then
|
||||||
cargo test --target "$TARGET" --verbose
|
cargo test --target "$TARGET" --verbose
|
||||||
|
|
||||||
# Run 'bat' on its own source code and the README
|
# Run 'bat' on its own source code and the README
|
||||||
|
|||||||
+5
-2
@@ -6,10 +6,10 @@ 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) |
|
| | 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) |
|
||||||
|----------------------------------------------|---------------------------------------------------------------------|----------------------------------|---------------------------------------------------------------------|------------------------------------------|----------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|
|
|----------------------------------------------|---------------------------------------------------------------------|----------------------------------|---------------------------------------------------------------------|------------------------------------------|----------------------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|-----------------------------------------------------|
|
||||||
| 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: |
|
| 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: |
|
||||||
| Git integration | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
|
| Git integration | :heavy_check_mark: | :x: | :x: | :x: | :x: | :x: | :x: | :x: |
|
||||||
| Automatic paging | :heavy_check_mark: | :x: | :x: | :x: | :x: | :heavy_check_mark: | :x: | :x: |
|
| Automatic paging | :heavy_check_mark: | :x: | :x: | :x: | :x: | :heavy_check_mark: | :x: | :x: |
|
||||||
| Languages (circa) | 60 | 300 | 200 | 7 | 80 | 130 | 30 | 130 |
|
| Languages (circa) | 100 | 300 | 200 | 7 | 80 | 130 | 30 | 130 |
|
||||||
| Extensible (languages, themes) | :heavy_check_mark: | (:heavy_check_mark:) | (:heavy_check_mark:) | :x: | (:heavy_check_mark:) | :x: | :x: | :x: |
|
| Extensible (languages, themes) | :heavy_check_mark: | (:heavy_check_mark:) | (:heavy_check_mark:) | :x: | (:heavy_check_mark:) | :x: | :x: | :x: |
|
||||||
| 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: |
|
| 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: |
|
||||||
| Execution time [ms] (`jquery-3.3.1.js`) | 624 | 789 | 400 | 80 | 300 | 316 | 157 | 695 |
|
| Execution time [ms] (`jquery-3.3.1.js`) | 624 | 789 | 400 | 80 | 300 | 316 | 157 | 695 |
|
||||||
@@ -18,3 +18,6 @@ if you are not looking for a program like `bat`, this comparison might not be fo
|
|||||||
|
|
||||||
If you think that some entries in this table are outdated or wrong, please open a ticket or pull
|
If you think that some entries in this table are outdated or wrong, please open a ticket or pull
|
||||||
request.
|
request.
|
||||||
|
|
||||||
|
Some other alternatives that are also related, but not yet included in the table:
|
||||||
|
- [lesspipe](https://github.com/wofr06/lesspipe)
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ names and file extensions.
|
|||||||
.IP
|
.IP
|
||||||
Display a list of supported languages for syntax highlighting.
|
Display a list of supported languages for syntax highlighting.
|
||||||
.HP
|
.HP
|
||||||
|
\fB\-m\fR, \fB\-\-map\-syntax\fR <from:to>...
|
||||||
|
.IP
|
||||||
|
Map a file extension or file name to an existing syntax. For example, to highlight
|
||||||
|
*.conf files with the INI syntax, use '\-m conf:ini'. To highlight files named
|
||||||
|
\&'.myignore' with the Git Ignore syntax, use '\-m .myignore:gitignore'.
|
||||||
|
.HP
|
||||||
\fB\-\-theme\fR <theme>
|
\fB\-\-theme\fR <theme>
|
||||||
.IP
|
.IP
|
||||||
Set the theme for syntax highlighting. Use '\-\-list\-themes' to see all
|
Set the theme for syntax highlighting. Use '\-\-list\-themes' to see all
|
||||||
@@ -36,10 +42,12 @@ Display a list of supported themes for syntax highlighting.
|
|||||||
Configure which elements (line numbers, file headers, grid borders, Git
|
Configure which elements (line numbers, file headers, grid borders, Git
|
||||||
modifications, ..) to display in addition to the file contents. The argument
|
modifications, ..) to display in addition to the file contents. The argument
|
||||||
is a comma\-separated list of components to display (e.g.
|
is a comma\-separated list of components to display (e.g.
|
||||||
\&'numbers,changes,grid') or a pre\-defined style ('full') [default: auto]
|
\&'numbers,changes,grid') or a pre\-defined style ('full'). To set a default
|
||||||
[possible values: auto, full, plain, changes, header, grid, numbers]
|
theme, export the BAT_STYLE environment variable (e.g.: export
|
||||||
|
BAT_STYLE="numbers"). [possible values: auto, full, plain, changes, header,
|
||||||
|
grid, numbers]
|
||||||
.HP
|
.HP
|
||||||
\fB\-p\fR
|
\fB\-p\fR, \fB\-\-plain\fR
|
||||||
.IP
|
.IP
|
||||||
Only show plain style, no decorations. This is an alias for '\-\-style=plain'
|
Only show plain style, no decorations. This is an alias for '\-\-style=plain'
|
||||||
.HP
|
.HP
|
||||||
@@ -62,32 +70,34 @@ prints lines 40 to the end of the file
|
|||||||
.HP
|
.HP
|
||||||
\fB\-\-color\fR <when>
|
\fB\-\-color\fR <when>
|
||||||
.IP
|
.IP
|
||||||
Specify when to use colored output. The automatic mode only enables colors if
|
Specify when to use colored output. The automatic mode only enables colors if an
|
||||||
an interactive terminal is detected. [default: auto] [possible values: auto,
|
interactive terminal is detected. Possible values: *auto*, never, always.
|
||||||
never, always]
|
|
||||||
.HP
|
.HP
|
||||||
\fB\-\-decorations\fR <when>
|
\fB\-\-decorations\fR <when>
|
||||||
.IP
|
.IP
|
||||||
Specify when to use the decorations that have been specified via '\-\-style'.
|
Specify when to use the decorations that have been specified via '\-\-style'. The
|
||||||
The automatic mode only enables decorations if an interactive terminal is
|
automatic mode only enables decorations if an interactive terminal is detected. Possible
|
||||||
detected. [default: auto] [possible values: auto, never, always]
|
values: *auto*, never, always.
|
||||||
.HP
|
.HP
|
||||||
\fB\-\-paging\fR <when>
|
\fB\-\-paging\fR <when>
|
||||||
.IP
|
.IP
|
||||||
Specify when to use the pager. To control which pager is used, set the PAGER
|
Specify when to use the pager. To control which pager is used, set the PAGER or
|
||||||
or BAT_PAGER environment variables (the latter takes precedence). The default
|
BAT_PAGER environment variables (the latter takes precedence). The default pager is
|
||||||
pager is 'less'. To disable the pager permanently, set BAT_PAGER to an empty
|
\&'less'. To disable the pager permanently, set BAT_PAGER to an empty string. Possible
|
||||||
string. [default: auto] [possible values: auto, never, always]
|
values: *auto*, never, always.
|
||||||
.HP
|
.HP
|
||||||
\fB\-\-wrap\fR <mode>
|
\fB\-\-wrap\fR <mode>
|
||||||
.IP
|
.IP
|
||||||
Specify the text\-wrapping mode. [default: character]
|
Specify the text\-wrapping mode (*auto*, never, character).
|
||||||
[possible values: character, never]
|
|
||||||
.HP
|
.HP
|
||||||
\fB\-u\fR
|
\fB\-\-tabs\fR <T>
|
||||||
.IP
|
.IP
|
||||||
This option exists for POSIX\-compliance reasons ('u' is for 'unbuffered'). The
|
Set the tab width to T spaces. Use a width of 0 to pass tabs through directly
|
||||||
output is always unbuffered \- this option is simply ignored.
|
.HP
|
||||||
|
\fB\-u\fR, \fB\-\-unbuffered\fR
|
||||||
|
.IP
|
||||||
|
This option exists for POSIX\-compliance reasons ('u' is for 'unbuffered'). The output is
|
||||||
|
always unbuffered \- this option is simply ignored.
|
||||||
.HP
|
.HP
|
||||||
\fB\-h\fR, \fB\-\-help\fR
|
\fB\-h\fR, \fB\-\-help\fR
|
||||||
.IP
|
.IP
|
||||||
|
|||||||
+130
-275
@@ -1,9 +1,12 @@
|
|||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::env;
|
use std::env;
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
use atty::{self, Stream};
|
use atty::{self, Stream};
|
||||||
|
|
||||||
use clap::{App as ClapApp, AppSettings, Arg, ArgGroup, ArgMatches, SubCommand};
|
use clap::ArgMatches;
|
||||||
|
use clap_app;
|
||||||
|
use wild;
|
||||||
|
|
||||||
use console::Term;
|
use console::Term;
|
||||||
|
|
||||||
@@ -11,24 +14,21 @@ use console::Term;
|
|||||||
use ansi_term;
|
use ansi_term;
|
||||||
|
|
||||||
use assets::BAT_THEME_DEFAULT;
|
use assets::BAT_THEME_DEFAULT;
|
||||||
|
use config::{get_args_from_config_file, get_args_from_env_var};
|
||||||
use errors::*;
|
use errors::*;
|
||||||
|
use inputfile::InputFile;
|
||||||
use line_range::LineRange;
|
use line_range::LineRange;
|
||||||
use style::{OutputComponent, OutputComponents, OutputWrap};
|
use style::{OutputComponent, OutputComponents, OutputWrap};
|
||||||
|
use syntax_mapping::SyntaxMapping;
|
||||||
|
use util::transpose;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub enum PagingMode {
|
pub enum PagingMode {
|
||||||
Always,
|
Always,
|
||||||
QuitIfOneScreen,
|
QuitIfOneScreen,
|
||||||
Never,
|
Never,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
|
||||||
pub enum InputFile<'a> {
|
|
||||||
StdIn,
|
|
||||||
Ordinary(&'a str),
|
|
||||||
ThemePreviewFile,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
pub struct Config<'a> {
|
pub struct Config<'a> {
|
||||||
/// List of files to print
|
/// List of files to print
|
||||||
@@ -40,6 +40,10 @@ pub struct Config<'a> {
|
|||||||
/// The character width of the terminal
|
/// The character width of the terminal
|
||||||
pub term_width: usize,
|
pub term_width: usize,
|
||||||
|
|
||||||
|
/// The width of tab characters.
|
||||||
|
/// Currently, a value of 0 will cause tabs to be passed through without expanding them.
|
||||||
|
pub tab_width: usize,
|
||||||
|
|
||||||
/// Whether or not to simply loop through all input (`cat` mode)
|
/// Whether or not to simply loop through all input (`cat` mode)
|
||||||
pub loop_through: bool,
|
pub loop_through: bool,
|
||||||
|
|
||||||
@@ -63,6 +67,9 @@ pub struct Config<'a> {
|
|||||||
|
|
||||||
/// The syntax highlighting theme
|
/// The syntax highlighting theme
|
||||||
pub theme: String,
|
pub theme: String,
|
||||||
|
|
||||||
|
/// File extension/name mappings
|
||||||
|
pub syntax_mapping: SyntaxMapping,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_truecolor_terminal() -> bool {
|
fn is_truecolor_terminal() -> bool {
|
||||||
@@ -71,286 +78,60 @@ fn is_truecolor_terminal() -> bool {
|
|||||||
.unwrap_or(false)
|
.unwrap_or(false)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Helper function that should might appear in Rust stable at some point
|
|
||||||
/// (https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.transpose)
|
|
||||||
fn transpose<T>(opt: Option<Result<T>>) -> Result<Option<T>> {
|
|
||||||
opt.map_or(Ok(None), |res| res.map(Some))
|
|
||||||
}
|
|
||||||
|
|
||||||
pub struct App {
|
pub struct App {
|
||||||
pub matches: ArgMatches<'static>,
|
pub matches: ArgMatches<'static>,
|
||||||
interactive_output: bool,
|
interactive_output: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App {
|
impl App {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Result<Self> {
|
||||||
|
#[cfg(windows)]
|
||||||
|
let _ = ansi_term::enable_ansi_support();
|
||||||
|
|
||||||
let interactive_output = atty::is(Stream::Stdout);
|
let interactive_output = atty::is(Stream::Stdout);
|
||||||
|
|
||||||
#[cfg(windows)]
|
Ok(App {
|
||||||
let interactive_output = interactive_output && ansi_term::enable_ansi_support().is_ok();
|
matches: Self::matches(interactive_output)?,
|
||||||
|
|
||||||
App {
|
|
||||||
matches: Self::matches(interactive_output),
|
|
||||||
interactive_output,
|
interactive_output,
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn matches(interactive_output: bool) -> ArgMatches<'static> {
|
fn matches(interactive_output: bool) -> Result<ArgMatches<'static>> {
|
||||||
let clap_color_setting = if interactive_output {
|
let args = if wild::args_os().nth(1) == Some("cache".into())
|
||||||
AppSettings::ColoredHelp
|
|| wild::args_os().any(|arg| arg == "--no-config")
|
||||||
|
{
|
||||||
|
// Skip the arguments in bats config file
|
||||||
|
|
||||||
|
wild::args_os().collect::<Vec<_>>()
|
||||||
} else {
|
} else {
|
||||||
AppSettings::ColorNever
|
let mut cli_args = wild::args_os();
|
||||||
|
|
||||||
|
// Read arguments from bats config file
|
||||||
|
let mut args = get_args_from_env_var()
|
||||||
|
.unwrap_or_else(|| get_args_from_config_file())
|
||||||
|
.chain_err(|| "Could not parse configuration file")?;
|
||||||
|
|
||||||
|
// Put the zero-th CLI argument (program name) first
|
||||||
|
args.insert(0, cli_args.next().unwrap());
|
||||||
|
|
||||||
|
// .. and the rest at the end
|
||||||
|
cli_args.for_each(|a| args.push(a));
|
||||||
|
|
||||||
|
args
|
||||||
};
|
};
|
||||||
|
|
||||||
ClapApp::new(crate_name!())
|
Ok(clap_app::build_app(interactive_output).get_matches_from(args))
|
||||||
.version(crate_version!())
|
|
||||||
.global_setting(clap_color_setting)
|
|
||||||
.global_setting(AppSettings::DeriveDisplayOrder)
|
|
||||||
.global_setting(AppSettings::UnifiedHelpMessage)
|
|
||||||
.global_setting(AppSettings::NextLineHelp)
|
|
||||||
.setting(AppSettings::InferSubcommands)
|
|
||||||
.setting(AppSettings::ArgsNegateSubcommands)
|
|
||||||
.setting(AppSettings::DisableHelpSubcommand)
|
|
||||||
.setting(AppSettings::VersionlessSubcommands)
|
|
||||||
.max_term_width(90)
|
|
||||||
.about(
|
|
||||||
"A cat(1) clone with wings.\n\n\
|
|
||||||
Use '--help' instead of '-h' to see a more detailed version of the help text.",
|
|
||||||
).long_about("A cat(1) clone with syntax highlighting and Git integration.")
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("FILE")
|
|
||||||
.help("File(s) to print / concatenate. Use '-' for standard input.")
|
|
||||||
.long_help(
|
|
||||||
"File(s) to print / concatenate. Use a dash ('-') or no argument at all \
|
|
||||||
to read from standard input.",
|
|
||||||
).multiple(true)
|
|
||||||
.empty_values(false),
|
|
||||||
)
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("language")
|
|
||||||
.short("l")
|
|
||||||
.long("language")
|
|
||||||
.overrides_with("language")
|
|
||||||
.help("Set the language for syntax highlighting.")
|
|
||||||
.long_help(
|
|
||||||
"Explicitly set the language for syntax highlighting. The language can be \
|
|
||||||
specified as a name (like 'C++' or 'LaTeX') or possible file extension \
|
|
||||||
(like 'cpp', 'hpp' or 'md'). Use '--list-languages' to show all supported \
|
|
||||||
language names and file extensions."
|
|
||||||
).takes_value(true),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("list-languages")
|
|
||||||
.long("list-languages")
|
|
||||||
.conflicts_with("list-themes")
|
|
||||||
.help("Display all supported languages.")
|
|
||||||
.long_help("Display a list of supported languages for syntax highlighting."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("theme")
|
|
||||||
.long("theme")
|
|
||||||
.overrides_with("theme")
|
|
||||||
.takes_value(true)
|
|
||||||
.help("Set the color theme for syntax highlighting.")
|
|
||||||
.long_help(
|
|
||||||
"Set the theme for syntax highlighting. Use '--list-themes' to \
|
|
||||||
see all available themes. To set a default theme, export the \
|
|
||||||
BAT_THEME environment variable (e.g.: export \
|
|
||||||
BAT_THEME=\"TwoDark\").",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("list-themes")
|
|
||||||
.long("list-themes")
|
|
||||||
.help("Display all supported highlighting themes.")
|
|
||||||
.long_help("Display a list of supported themes for syntax highlighting."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("style")
|
|
||||||
.long("style")
|
|
||||||
.value_name("style-components")
|
|
||||||
.use_delimiter(true)
|
|
||||||
.takes_value(true)
|
|
||||||
.possible_values(&[
|
|
||||||
"auto", "full", "plain", "changes", "header", "grid", "numbers",
|
|
||||||
]).default_value("auto")
|
|
||||||
.help("Comma-separated list of style elements to display.")
|
|
||||||
.long_help(
|
|
||||||
"Configure which elements (line numbers, file headers, grid \
|
|
||||||
borders, Git modifications, ..) to display in addition to the \
|
|
||||||
file contents. The argument is a comma-separated list of \
|
|
||||||
components to display (e.g. 'numbers,changes,grid') or a \
|
|
||||||
pre-defined style ('full')",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("plain")
|
|
||||||
.overrides_with("plain")
|
|
||||||
.short("p")
|
|
||||||
.long("plain")
|
|
||||||
.conflicts_with("style")
|
|
||||||
.conflicts_with("number")
|
|
||||||
.help("Show plain style (alias for '--style=plain').")
|
|
||||||
.long_help(
|
|
||||||
"Only show plain style, no decorations. This is an alias for \
|
|
||||||
'--style=plain'",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("number")
|
|
||||||
.long("number")
|
|
||||||
.overrides_with("number")
|
|
||||||
.short("n")
|
|
||||||
.conflicts_with("style")
|
|
||||||
.help("Show line numbers (alias for '--style=numbers').")
|
|
||||||
.long_help(
|
|
||||||
"Only show line numbers, no other decorations. This is an alias for \
|
|
||||||
'--style=numbers'",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("line-range")
|
|
||||||
.long("line-range")
|
|
||||||
.overrides_with("line-range")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("N:M")
|
|
||||||
.help("Only print the lines from N to M.")
|
|
||||||
.long_help(
|
|
||||||
"Only print the specified range of lines for each file. \
|
|
||||||
For example:\n \
|
|
||||||
'--line-range 30:40' prints lines 30 to 40\n \
|
|
||||||
'--line-range :40' prints lines 1 to 40\n \
|
|
||||||
'--line-range 40:' prints lines 40 to the end of the file",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("color")
|
|
||||||
.long("color")
|
|
||||||
.overrides_with("color")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("when")
|
|
||||||
.possible_values(&["auto", "never", "always"])
|
|
||||||
.default_value("auto")
|
|
||||||
.help("When to use colors.")
|
|
||||||
.long_help("Specify when to use colored output. The automatic mode \
|
|
||||||
only enables colors if an interactive terminal is detected."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("decorations")
|
|
||||||
.long("decorations")
|
|
||||||
.overrides_with("decorations")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("when")
|
|
||||||
.possible_values(&["auto", "never", "always"])
|
|
||||||
.default_value("auto")
|
|
||||||
.help("When to show the decorations specified by '--style'.")
|
|
||||||
.long_help("Specify when to use the decorations that have been specified \
|
|
||||||
via '--style'. The automatic mode only enables decorations if \
|
|
||||||
an interactive terminal is detected."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("paging")
|
|
||||||
.long("paging")
|
|
||||||
.overrides_with("paging")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("when")
|
|
||||||
.possible_values(&["auto", "never", "always"])
|
|
||||||
.default_value("auto")
|
|
||||||
.help("Specify when to use the pager.")
|
|
||||||
.long_help("Specify when to use the pager. To control which pager \
|
|
||||||
is used, set the PAGER or BAT_PAGER environment \
|
|
||||||
variables (the latter takes precedence). The default \
|
|
||||||
pager is 'less'. To disable the pager permanently, set \
|
|
||||||
BAT_PAGER to an empty string."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("wrap")
|
|
||||||
.long("wrap")
|
|
||||||
.overrides_with("wrap")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("mode")
|
|
||||||
.possible_values(&["character", "never"])
|
|
||||||
.default_value("character")
|
|
||||||
.help("Specify the text-wrapping mode.")
|
|
||||||
.long_help("Specify the text-wrapping mode."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("unbuffered")
|
|
||||||
.short("u")
|
|
||||||
.hidden_short_help(true)
|
|
||||||
.long_help(
|
|
||||||
"This option exists for POSIX-compliance reasons ('u' is for \
|
|
||||||
'unbuffered'). The output is always unbuffered - this option \
|
|
||||||
is simply ignored.",
|
|
||||||
),
|
|
||||||
).subcommand(
|
|
||||||
SubCommand::with_name("cache")
|
|
||||||
.about("Modify the syntax-definition and theme cache")
|
|
||||||
.arg(
|
|
||||||
Arg::with_name("init")
|
|
||||||
.long("init")
|
|
||||||
.short("i")
|
|
||||||
.help("Initialize the syntax/theme cache.")
|
|
||||||
.long_help(
|
|
||||||
"Initialize the syntax/theme cache by loading from the \
|
|
||||||
source directory (default: the configuration directory).",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("clear")
|
|
||||||
.long("clear")
|
|
||||||
.short("c")
|
|
||||||
.help("Remove the cached syntax definitions and themes."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("config-dir")
|
|
||||||
.long("config-dir")
|
|
||||||
.short("d")
|
|
||||||
.help("Show bat's configuration directory."),
|
|
||||||
).group(
|
|
||||||
ArgGroup::with_name("cache-actions")
|
|
||||||
.args(&["init", "clear", "config-dir"])
|
|
||||||
.required(true),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("source")
|
|
||||||
.long("source")
|
|
||||||
.requires("init")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("dir")
|
|
||||||
.help("Use a different directory to load syntaxes and themes from."),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("target")
|
|
||||||
.long("target")
|
|
||||||
.requires("init")
|
|
||||||
.takes_value(true)
|
|
||||||
.value_name("dir")
|
|
||||||
.help(
|
|
||||||
"Use a different directory to store the cached syntax and theme set.",
|
|
||||||
),
|
|
||||||
).arg(
|
|
||||||
Arg::with_name("blank")
|
|
||||||
.long("blank")
|
|
||||||
.requires("init")
|
|
||||||
.help("Create completely new syntax and theme sets \
|
|
||||||
(instead of appending to the default sets).")
|
|
||||||
),
|
|
||||||
).help_message("Print this help message.")
|
|
||||||
.version_message("Show version information.")
|
|
||||||
.get_matches()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn config(&self) -> Result<Config> {
|
pub fn config(&self) -> Result<Config> {
|
||||||
let files = self.files();
|
let files = self.files();
|
||||||
|
let output_components = self.output_components()?;
|
||||||
|
|
||||||
Ok(Config {
|
let paging_mode = match self.matches.value_of("paging") {
|
||||||
true_color: is_truecolor_terminal(),
|
Some("always") => PagingMode::Always,
|
||||||
output_components: self.output_components()?,
|
Some("never") => PagingMode::Never,
|
||||||
language: self.matches.value_of("language"),
|
Some("auto") | _ => {
|
||||||
output_wrap: if !self.interactive_output {
|
if files.contains(&InputFile::StdIn) {
|
||||||
// We don't have the tty width when piping to another program.
|
|
||||||
// There's no point in wrapping when this is the case.
|
|
||||||
OutputWrap::None
|
|
||||||
} else {
|
|
||||||
match self.matches.value_of("wrap") {
|
|
||||||
Some("character") => OutputWrap::Character,
|
|
||||||
Some("never") | _ => OutputWrap::None,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
colored_output: match self.matches.value_of("color") {
|
|
||||||
Some("always") => true,
|
|
||||||
Some("never") => false,
|
|
||||||
Some("auto") | _ => self.interactive_output,
|
|
||||||
},
|
|
||||||
paging_mode: match self.matches.value_of("paging") {
|
|
||||||
Some("always") => PagingMode::Always,
|
|
||||||
Some("never") => PagingMode::Never,
|
|
||||||
Some("auto") | _ => if files.contains(&InputFile::StdIn) {
|
|
||||||
// If we are reading from stdin, only enable paging if we write to an
|
// If we are reading from stdin, only enable paging if we write to an
|
||||||
// interactive terminal and if we do not *read* from an interactive
|
// interactive terminal and if we do not *read* from an interactive
|
||||||
// terminal.
|
// terminal.
|
||||||
@@ -365,13 +146,72 @@ impl App {
|
|||||||
} else {
|
} else {
|
||||||
PagingMode::Never
|
PagingMode::Never
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
let mut syntax_mapping = SyntaxMapping::new();
|
||||||
|
|
||||||
|
if let Some(values) = self.matches.values_of("map-syntax") {
|
||||||
|
for from_to in values {
|
||||||
|
let parts: Vec<_> = from_to.split(":").collect();
|
||||||
|
|
||||||
|
if parts.len() != 2 {
|
||||||
|
return Err("Invalid syntax mapping. The format of the -m/--map-syntax option is 'from:to'.".into());
|
||||||
|
}
|
||||||
|
|
||||||
|
syntax_mapping.insert(parts[0].into(), parts[1].into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Config {
|
||||||
|
true_color: is_truecolor_terminal(),
|
||||||
|
language: self.matches.value_of("language"),
|
||||||
|
output_wrap: if !self.interactive_output {
|
||||||
|
// We don't have the tty width when piping to another program.
|
||||||
|
// There's no point in wrapping when this is the case.
|
||||||
|
OutputWrap::None
|
||||||
|
} else {
|
||||||
|
match self.matches.value_of("wrap") {
|
||||||
|
Some("character") => OutputWrap::Character,
|
||||||
|
Some("never") => OutputWrap::None,
|
||||||
|
Some("auto") | _ => {
|
||||||
|
if output_components.plain() {
|
||||||
|
OutputWrap::None
|
||||||
|
} else {
|
||||||
|
OutputWrap::Character
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
term_width: Term::stdout().size().1 as usize,
|
colored_output: match self.matches.value_of("color") {
|
||||||
|
Some("always") => true,
|
||||||
|
Some("never") => false,
|
||||||
|
Some("auto") | _ => self.interactive_output,
|
||||||
|
},
|
||||||
|
paging_mode,
|
||||||
|
term_width: self
|
||||||
|
.matches
|
||||||
|
.value_of("terminal-width")
|
||||||
|
.and_then(|w| w.parse().ok())
|
||||||
|
.unwrap_or(Term::stdout().size().1 as usize),
|
||||||
loop_through: !(self.interactive_output
|
loop_through: !(self.interactive_output
|
||||||
|| self.matches.value_of("color") == Some("always")
|
|| self.matches.value_of("color") == Some("always")
|
||||||
|| self.matches.value_of("decorations") == Some("always")),
|
|| self.matches.value_of("decorations") == Some("always")),
|
||||||
files,
|
files,
|
||||||
|
tab_width: self
|
||||||
|
.matches
|
||||||
|
.value_of("tabs")
|
||||||
|
.map(String::from)
|
||||||
|
.or_else(|| env::var("BAT_TABS").ok())
|
||||||
|
.and_then(|t| t.parse().ok())
|
||||||
|
.unwrap_or(
|
||||||
|
if output_components.plain() && paging_mode == PagingMode::Never {
|
||||||
|
0
|
||||||
|
} else {
|
||||||
|
8
|
||||||
|
},
|
||||||
|
),
|
||||||
theme: self
|
theme: self
|
||||||
.matches
|
.matches
|
||||||
.value_of("theme")
|
.value_of("theme")
|
||||||
@@ -379,6 +219,8 @@ impl App {
|
|||||||
.or_else(|| env::var("BAT_THEME").ok())
|
.or_else(|| env::var("BAT_THEME").ok())
|
||||||
.unwrap_or(String::from(BAT_THEME_DEFAULT)),
|
.unwrap_or(String::from(BAT_THEME_DEFAULT)),
|
||||||
line_range: transpose(self.matches.value_of("line-range").map(LineRange::from))?,
|
line_range: transpose(self.matches.value_of("line-range").map(LineRange::from))?,
|
||||||
|
output_components,
|
||||||
|
syntax_mapping,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -393,8 +235,10 @@ impl App {
|
|||||||
} else {
|
} else {
|
||||||
InputFile::Ordinary(filename)
|
InputFile::Ordinary(filename)
|
||||||
}
|
}
|
||||||
}).collect()
|
})
|
||||||
}).unwrap_or_else(|| vec![InputFile::StdIn])
|
.collect()
|
||||||
|
})
|
||||||
|
.unwrap_or_else(|| vec![InputFile::StdIn])
|
||||||
}
|
}
|
||||||
|
|
||||||
fn output_components(&self) -> Result<OutputComponents> {
|
fn output_components(&self) -> Result<OutputComponents> {
|
||||||
@@ -407,7 +251,18 @@ impl App {
|
|||||||
} else if matches.is_present("plain") {
|
} else if matches.is_present("plain") {
|
||||||
[OutputComponent::Plain].iter().cloned().collect()
|
[OutputComponent::Plain].iter().cloned().collect()
|
||||||
} else {
|
} else {
|
||||||
values_t!(matches.values_of("style"), OutputComponent)?
|
let env_style_components: Option<Vec<OutputComponent>> =
|
||||||
|
transpose(env::var("BAT_STYLE").ok().map(|style_str| {
|
||||||
|
style_str
|
||||||
|
.split(",")
|
||||||
|
.map(|x| OutputComponent::from_str(&x))
|
||||||
|
.collect::<Result<Vec<OutputComponent>>>()
|
||||||
|
}))?;
|
||||||
|
|
||||||
|
values_t!(matches.values_of("style"), OutputComponent)
|
||||||
|
.ok()
|
||||||
|
.or(env_style_components)
|
||||||
|
.unwrap_or(vec![OutputComponent::Full])
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|style| style.components(self.interactive_output))
|
.map(|style| style.components(self.interactive_output))
|
||||||
.fold(HashSet::new(), |mut acc, components| {
|
.fold(HashSet::new(), |mut acc, components| {
|
||||||
|
|||||||
+67
-74
@@ -1,22 +1,18 @@
|
|||||||
use directories::ProjectDirs;
|
|
||||||
use errors::*;
|
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
use std::collections::BTreeMap;
|
use std::collections::BTreeMap;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
|
use std::io::BufReader;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
|
|
||||||
use syntect::dumps::{dump_to_file, from_binary, from_reader};
|
use syntect::dumps::{dump_to_file, from_binary, from_reader};
|
||||||
use syntect::highlighting::{Theme, ThemeSet};
|
use syntect::highlighting::{Theme, ThemeSet};
|
||||||
use syntect::parsing::{SyntaxDefinition, SyntaxSet};
|
use syntect::parsing::{SyntaxReference, SyntaxSet, SyntaxSetBuilder};
|
||||||
|
|
||||||
#[cfg(unix)]
|
use dirs::PROJECT_DIRS;
|
||||||
use std::os::unix::fs::FileTypeExt;
|
|
||||||
|
|
||||||
use app::InputFile;
|
use errors::*;
|
||||||
|
use inputfile::{InputFile, InputFileReader};
|
||||||
lazy_static! {
|
use syntax_mapping::SyntaxMapping;
|
||||||
static ref PROJECT_DIRS: ProjectDirs =
|
|
||||||
ProjectDirs::from("", "", crate_name!()).expect("Could not get home directory");
|
|
||||||
}
|
|
||||||
|
|
||||||
pub const BAT_THEME_DEFAULT: &str = "Monokai Extended";
|
pub const BAT_THEME_DEFAULT: &str = "Monokai Extended";
|
||||||
|
|
||||||
@@ -30,31 +26,20 @@ impl HighlightingAssets {
|
|||||||
Self::from_cache().unwrap_or_else(|_| Self::from_binary())
|
Self::from_cache().unwrap_or_else(|_| Self::from_binary())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn empty() -> Self {
|
|
||||||
let mut syntax_set = SyntaxSet::new();
|
|
||||||
syntax_set.load_plain_text_syntax();
|
|
||||||
|
|
||||||
let theme_set = ThemeSet {
|
|
||||||
themes: BTreeMap::new(),
|
|
||||||
};
|
|
||||||
HighlightingAssets {
|
|
||||||
syntax_set,
|
|
||||||
theme_set,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn from_files(dir: Option<&Path>, start_empty: bool) -> Result<Self> {
|
pub fn from_files(dir: Option<&Path>, start_empty: bool) -> Result<Self> {
|
||||||
let source_dir = dir.unwrap_or_else(|| PROJECT_DIRS.config_dir());
|
let source_dir = dir.unwrap_or_else(|| PROJECT_DIRS.config_dir());
|
||||||
|
|
||||||
let mut assets = if start_empty {
|
let mut theme_set = if start_empty {
|
||||||
Self::empty()
|
ThemeSet {
|
||||||
|
themes: BTreeMap::new(),
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Self::from_binary_unlinked()
|
Self::get_integrated_themeset()
|
||||||
};
|
};
|
||||||
|
|
||||||
let theme_dir = source_dir.join("themes");
|
let theme_dir = source_dir.join("themes");
|
||||||
|
|
||||||
let res = extend_theme_set(&mut assets.theme_set, &theme_dir);
|
let res = theme_set.add_from_folder(&theme_dir);
|
||||||
if !res.is_ok() {
|
if !res.is_ok() {
|
||||||
println!(
|
println!(
|
||||||
"No themes were found in '{}', using the default set",
|
"No themes were found in '{}', using the default set",
|
||||||
@@ -62,9 +47,17 @@ impl HighlightingAssets {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let mut syntax_set_builder = if start_empty {
|
||||||
|
let mut builder = SyntaxSetBuilder::new();
|
||||||
|
builder.add_plain_text_syntax();
|
||||||
|
builder
|
||||||
|
} else {
|
||||||
|
Self::get_integrated_syntaxset().into_builder()
|
||||||
|
};
|
||||||
|
|
||||||
let syntax_dir = source_dir.join("syntaxes");
|
let syntax_dir = source_dir.join("syntaxes");
|
||||||
if syntax_dir.exists() {
|
if syntax_dir.exists() {
|
||||||
assets.syntax_set.load_syntaxes(syntax_dir, true)?;
|
syntax_set_builder.add_from_folder(syntax_dir, true)?;
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
"No syntaxes were found in '{}', using the default set.",
|
"No syntaxes were found in '{}', using the default set.",
|
||||||
@@ -72,7 +65,10 @@ impl HighlightingAssets {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(assets)
|
Ok(HighlightingAssets {
|
||||||
|
syntax_set: syntax_set_builder.build(),
|
||||||
|
theme_set,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_cache() -> Result<Self> {
|
fn from_cache() -> Result<Self> {
|
||||||
@@ -83,9 +79,8 @@ impl HighlightingAssets {
|
|||||||
syntax_set_path().to_string_lossy()
|
syntax_set_path().to_string_lossy()
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let mut syntax_set: SyntaxSet =
|
let syntax_set: SyntaxSet = from_reader(BufReader::new(syntax_set_file))
|
||||||
from_reader(syntax_set_file).chain_err(|| "Could not parse cached syntax set")?;
|
.chain_err(|| "Could not parse cached syntax set")?;
|
||||||
syntax_set.link_syntaxes();
|
|
||||||
|
|
||||||
let theme_set_file = File::open(&theme_set_path).chain_err(|| {
|
let theme_set_file = File::open(&theme_set_path).chain_err(|| {
|
||||||
format!(
|
format!(
|
||||||
@@ -93,8 +88,8 @@ impl HighlightingAssets {
|
|||||||
theme_set_path.to_string_lossy()
|
theme_set_path.to_string_lossy()
|
||||||
)
|
)
|
||||||
})?;
|
})?;
|
||||||
let theme_set: ThemeSet =
|
let theme_set: ThemeSet = from_reader(BufReader::new(theme_set_file))
|
||||||
from_reader(theme_set_file).chain_err(|| "Could not parse cached theme set")?;
|
.chain_err(|| "Could not parse cached theme set")?;
|
||||||
|
|
||||||
Ok(HighlightingAssets {
|
Ok(HighlightingAssets {
|
||||||
syntax_set,
|
syntax_set,
|
||||||
@@ -102,9 +97,17 @@ impl HighlightingAssets {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_binary_unlinked() -> Self {
|
fn get_integrated_syntaxset() -> SyntaxSet {
|
||||||
let syntax_set: SyntaxSet = from_binary(include_bytes!("../assets/syntaxes.bin"));
|
from_binary(include_bytes!("../assets/syntaxes.bin"))
|
||||||
let theme_set: ThemeSet = from_binary(include_bytes!("../assets/themes.bin"));
|
}
|
||||||
|
|
||||||
|
fn get_integrated_themeset() -> ThemeSet {
|
||||||
|
from_binary(include_bytes!("../assets/themes.bin"))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn from_binary() -> Self {
|
||||||
|
let syntax_set = Self::get_integrated_syntaxset();
|
||||||
|
let theme_set = Self::get_integrated_themeset();
|
||||||
|
|
||||||
HighlightingAssets {
|
HighlightingAssets {
|
||||||
syntax_set,
|
syntax_set,
|
||||||
@@ -112,12 +115,6 @@ impl HighlightingAssets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn from_binary() -> Self {
|
|
||||||
let mut assets = Self::from_binary_unlinked();
|
|
||||||
assets.syntax_set.link_syntaxes();
|
|
||||||
assets
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn save(&self, dir: Option<&Path>) -> Result<()> {
|
pub fn save(&self, dir: Option<&Path>) -> Result<()> {
|
||||||
let target_dir = dir.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
let target_dir = dir.unwrap_or_else(|| PROJECT_DIRS.cache_dir());
|
||||||
let _ = fs::create_dir(target_dir);
|
let _ = fs::create_dir(target_dir);
|
||||||
@@ -166,29 +163,40 @@ impl HighlightingAssets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_syntax(&self, language: Option<&str>, filename: InputFile) -> &SyntaxDefinition {
|
pub fn get_syntax(
|
||||||
|
&self,
|
||||||
|
language: Option<&str>,
|
||||||
|
filename: InputFile,
|
||||||
|
reader: &mut InputFileReader,
|
||||||
|
mapping: &SyntaxMapping,
|
||||||
|
) -> &SyntaxReference {
|
||||||
let syntax = match (language, filename) {
|
let syntax = match (language, filename) {
|
||||||
(Some(language), _) => self.syntax_set.find_syntax_by_token(language),
|
(Some(language), _) => self.syntax_set.find_syntax_by_token(language),
|
||||||
(None, InputFile::Ordinary(filename)) => {
|
(None, InputFile::Ordinary(filename)) => {
|
||||||
#[cfg(not(unix))]
|
let path = Path::new(filename);
|
||||||
let may_read_from_file = true;
|
let file_name = path.file_name().and_then(|n| n.to_str()).unwrap_or("");
|
||||||
|
let extension = path.extension().and_then(|x| x.to_str()).unwrap_or("");
|
||||||
|
|
||||||
// Do not peek at the file (to determine the syntax) if it is a FIFO because they can
|
let file_name = mapping.replace(file_name);
|
||||||
// only be read once.
|
let extension = mapping.replace(extension);
|
||||||
#[cfg(unix)]
|
|
||||||
let may_read_from_file = !fs::metadata(filename)
|
|
||||||
.map(|m| m.file_type().is_fifo())
|
|
||||||
.unwrap_or(false);
|
|
||||||
|
|
||||||
if may_read_from_file {
|
let ext_syntax = self
|
||||||
self.syntax_set
|
.syntax_set
|
||||||
.find_syntax_for_file(filename)
|
.find_syntax_by_extension(&file_name)
|
||||||
.unwrap_or(None)
|
.or_else(|| self.syntax_set.find_syntax_by_extension(&extension));
|
||||||
|
let line_syntax = if ext_syntax.is_none() {
|
||||||
|
String::from_utf8(reader.first_line.clone())
|
||||||
|
.ok()
|
||||||
|
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
};
|
||||||
|
let syntax = ext_syntax.or(line_syntax);
|
||||||
|
syntax
|
||||||
}
|
}
|
||||||
(None, InputFile::StdIn) => None,
|
(None, InputFile::StdIn) => String::from_utf8(reader.first_line.clone())
|
||||||
|
.ok()
|
||||||
|
.and_then(|l| self.syntax_set.find_syntax_by_first_line(&l)),
|
||||||
(_, InputFile::ThemePreviewFile) => self.syntax_set.find_syntax_by_name("Rust"),
|
(_, InputFile::ThemePreviewFile) => self.syntax_set.find_syntax_by_name("Rust"),
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -196,21 +204,6 @@ impl HighlightingAssets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: this function will soon be part of syntect's `ThemeSet`.
|
|
||||||
fn extend_theme_set<P: AsRef<Path>>(theme_set: &mut ThemeSet, folder: P) -> Result<()> {
|
|
||||||
let paths = ThemeSet::discover_theme_paths(folder)?;
|
|
||||||
for p in &paths {
|
|
||||||
let theme = ThemeSet::get_theme(p)?;
|
|
||||||
let basename = p
|
|
||||||
.file_stem()
|
|
||||||
.and_then(|x| x.to_str())
|
|
||||||
.ok_or("Could not get theme basename")?;
|
|
||||||
theme_set.themes.insert(basename.to_owned(), theme);
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn theme_set_path() -> PathBuf {
|
fn theme_set_path() -> PathBuf {
|
||||||
PROJECT_DIRS.cache_dir().join("themes.bin")
|
PROJECT_DIRS.cache_dir().join("themes.bin")
|
||||||
}
|
}
|
||||||
|
|||||||
+332
@@ -0,0 +1,332 @@
|
|||||||
|
use clap::{App as ClapApp, AppSettings, Arg, ArgGroup, SubCommand};
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
pub fn build_app(interactive_output: bool) -> ClapApp<'static, 'static> {
|
||||||
|
let clap_color_setting = if interactive_output {
|
||||||
|
AppSettings::ColoredHelp
|
||||||
|
} else {
|
||||||
|
AppSettings::ColorNever
|
||||||
|
};
|
||||||
|
|
||||||
|
// Check if the current directory contains a file name cache, if it does
|
||||||
|
// do not make the arguements for subcommand 'cache' required.
|
||||||
|
let arg_group_required = !Path::new("cache").exists();
|
||||||
|
|
||||||
|
ClapApp::new(crate_name!())
|
||||||
|
.version(crate_version!())
|
||||||
|
.global_setting(clap_color_setting)
|
||||||
|
.global_setting(AppSettings::DeriveDisplayOrder)
|
||||||
|
.global_setting(AppSettings::UnifiedHelpMessage)
|
||||||
|
.global_setting(AppSettings::HidePossibleValuesInHelp)
|
||||||
|
.setting(AppSettings::InferSubcommands)
|
||||||
|
.setting(AppSettings::ArgsNegateSubcommands)
|
||||||
|
.setting(AppSettings::DisableHelpSubcommand)
|
||||||
|
.setting(AppSettings::VersionlessSubcommands)
|
||||||
|
.max_term_width(100)
|
||||||
|
.about(
|
||||||
|
"A cat(1) clone with wings.\n\n\
|
||||||
|
Use '--help' instead of '-h' to see a more detailed version of the help text.",
|
||||||
|
)
|
||||||
|
.long_about("A cat(1) clone with syntax highlighting and Git integration.")
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("FILE")
|
||||||
|
.help("File(s) to print / concatenate. Use '-' for standard input.")
|
||||||
|
.long_help(
|
||||||
|
"File(s) to print / concatenate. Use a dash ('-') or no argument at all \
|
||||||
|
to read from standard input.",
|
||||||
|
)
|
||||||
|
.multiple(true)
|
||||||
|
.empty_values(false),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("language")
|
||||||
|
.short("l")
|
||||||
|
.long("language")
|
||||||
|
.overrides_with("language")
|
||||||
|
.help("Set the language for syntax highlighting.")
|
||||||
|
.long_help(
|
||||||
|
"Explicitly set the language for syntax highlighting. The language can be \
|
||||||
|
specified as a name (like 'C++' or 'LaTeX') or possible file extension \
|
||||||
|
(like 'cpp', 'hpp' or 'md'). Use '--list-languages' to show all supported \
|
||||||
|
language names and file extensions.",
|
||||||
|
)
|
||||||
|
.takes_value(true),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("list-languages")
|
||||||
|
.long("list-languages")
|
||||||
|
.conflicts_with("list-themes")
|
||||||
|
.help("Display all supported languages.")
|
||||||
|
.long_help("Display a list of supported languages for syntax highlighting."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("map-syntax")
|
||||||
|
.short("m")
|
||||||
|
.long("map-syntax")
|
||||||
|
.multiple(true)
|
||||||
|
.takes_value(true)
|
||||||
|
.number_of_values(1)
|
||||||
|
.value_name("from:to")
|
||||||
|
.help("Map a file extension or name to an existing syntax.")
|
||||||
|
.long_help(
|
||||||
|
"Map a file extension or file name to an existing syntax. For example, \
|
||||||
|
to highlight *.conf files with the INI syntax, use '-m conf:ini'. \
|
||||||
|
To highlight files named '.myignore' with the Git Ignore syntax, use \
|
||||||
|
'-m .myignore:gitignore'.",
|
||||||
|
)
|
||||||
|
.takes_value(true),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("theme")
|
||||||
|
.long("theme")
|
||||||
|
.overrides_with("theme")
|
||||||
|
.takes_value(true)
|
||||||
|
.help("Set the color theme for syntax highlighting.")
|
||||||
|
.long_help(
|
||||||
|
"Set the theme for syntax highlighting. Use '--list-themes' to \
|
||||||
|
see all available themes. To set a default theme, export the \
|
||||||
|
BAT_THEME environment variable (e.g.: export \
|
||||||
|
BAT_THEME=\"TwoDark\").",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("list-themes")
|
||||||
|
.long("list-themes")
|
||||||
|
.help("Display all supported highlighting themes.")
|
||||||
|
.long_help("Display a list of supported themes for syntax highlighting."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("style")
|
||||||
|
.long("style")
|
||||||
|
.value_name("style-components")
|
||||||
|
.use_delimiter(true)
|
||||||
|
.takes_value(true)
|
||||||
|
.possible_values(&[
|
||||||
|
"auto", "full", "plain", "changes", "header", "grid", "numbers",
|
||||||
|
])
|
||||||
|
.help(
|
||||||
|
"Comma-separated list of style elements to display \
|
||||||
|
(*auto*, full, plain, changes, header, grid, numbers).",
|
||||||
|
)
|
||||||
|
.long_help(
|
||||||
|
"Configure which elements (line numbers, file headers, grid \
|
||||||
|
borders, Git modifications, ..) to display in addition to the \
|
||||||
|
file contents. The argument is a comma-separated list of \
|
||||||
|
components to display (e.g. 'numbers,changes,grid') or a \
|
||||||
|
pre-defined style ('full'). To set a default theme, export the \
|
||||||
|
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"numbers\"). \
|
||||||
|
Possible values: *auto*, full, plain, changes, header, grid, numbers.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("plain")
|
||||||
|
.overrides_with("plain")
|
||||||
|
.short("p")
|
||||||
|
.long("plain")
|
||||||
|
.conflicts_with("style")
|
||||||
|
.conflicts_with("number")
|
||||||
|
.help("Show plain style (alias for '--style=plain').")
|
||||||
|
.long_help(
|
||||||
|
"Only show plain style, no decorations. This is an alias for \
|
||||||
|
'--style=plain'",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("number")
|
||||||
|
.long("number")
|
||||||
|
.overrides_with("number")
|
||||||
|
.short("n")
|
||||||
|
.conflicts_with("style")
|
||||||
|
.help("Show line numbers (alias for '--style=numbers').")
|
||||||
|
.long_help(
|
||||||
|
"Only show line numbers, no other decorations. This is an alias for \
|
||||||
|
'--style=numbers'",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("line-range")
|
||||||
|
.long("line-range")
|
||||||
|
.overrides_with("line-range")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("N:M")
|
||||||
|
.help("Only print the lines from N to M.")
|
||||||
|
.long_help(
|
||||||
|
"Only print the specified range of lines for each file. \
|
||||||
|
For example:\n \
|
||||||
|
'--line-range 30:40' prints lines 30 to 40\n \
|
||||||
|
'--line-range :40' prints lines 1 to 40\n \
|
||||||
|
'--line-range 40:' prints lines 40 to the end of the file",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("color")
|
||||||
|
.long("color")
|
||||||
|
.overrides_with("color")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("when")
|
||||||
|
.possible_values(&["auto", "never", "always"])
|
||||||
|
.hide_default_value(true)
|
||||||
|
.default_value("auto")
|
||||||
|
.help("When to use colors (*auto*, never, always).")
|
||||||
|
.long_help(
|
||||||
|
"Specify when to use colored output. The automatic mode \
|
||||||
|
only enables colors if an interactive terminal is detected. \
|
||||||
|
Possible values: *auto*, never, always.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("decorations")
|
||||||
|
.long("decorations")
|
||||||
|
.overrides_with("decorations")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("when")
|
||||||
|
.possible_values(&["auto", "never", "always"])
|
||||||
|
.default_value("auto")
|
||||||
|
.hide_default_value(true)
|
||||||
|
.help("When to show the decorations (*auto*, never, always).")
|
||||||
|
.long_help(
|
||||||
|
"Specify when to use the decorations that have been specified \
|
||||||
|
via '--style'. The automatic mode only enables decorations if \
|
||||||
|
an interactive terminal is detected. Possible values: *auto*, never, always.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("paging")
|
||||||
|
.long("paging")
|
||||||
|
.overrides_with("paging")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("when")
|
||||||
|
.possible_values(&["auto", "never", "always"])
|
||||||
|
.default_value("auto")
|
||||||
|
.hide_default_value(true)
|
||||||
|
.help("Specify when to use the pager (*auto*, never, always).")
|
||||||
|
.long_help(
|
||||||
|
"Specify when to use the pager. To control which pager \
|
||||||
|
is used, set the PAGER or BAT_PAGER environment \
|
||||||
|
variables (the latter takes precedence). The default \
|
||||||
|
pager is 'less'. To disable the pager permanently, set \
|
||||||
|
BAT_PAGER to an empty string. \
|
||||||
|
Possible values: *auto*, never, always.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("wrap")
|
||||||
|
.long("wrap")
|
||||||
|
.overrides_with("wrap")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("mode")
|
||||||
|
.possible_values(&["auto", "never", "character"])
|
||||||
|
.default_value("auto")
|
||||||
|
.hide_default_value(true)
|
||||||
|
.help("Specify the text-wrapping mode (*auto*, never, character).")
|
||||||
|
.long_help("Specify the text-wrapping mode (*auto*, never, character)."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("tabs")
|
||||||
|
.long("tabs")
|
||||||
|
.overrides_with("tabs")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("T")
|
||||||
|
.validator(
|
||||||
|
|t| {
|
||||||
|
t.parse::<u32>()
|
||||||
|
.map_err(|_t| "must be a number")
|
||||||
|
.map(|_t| ()) // Convert to Result<(), &str>
|
||||||
|
.map_err(|e| e.to_string())
|
||||||
|
}, // Convert to Result<(), String>
|
||||||
|
)
|
||||||
|
.help("Set the tab width to T spaces.")
|
||||||
|
.long_help(
|
||||||
|
"Set the tab width to T spaces. Use a width of 0 to pass tabs through \
|
||||||
|
directly",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("unbuffered")
|
||||||
|
.short("u")
|
||||||
|
.long("unbuffered")
|
||||||
|
.hidden_short_help(true)
|
||||||
|
.long_help(
|
||||||
|
"This option exists for POSIX-compliance reasons ('u' is for \
|
||||||
|
'unbuffered'). The output is always unbuffered - this option \
|
||||||
|
is simply ignored.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("terminal-width")
|
||||||
|
.long("terminal-width")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("width")
|
||||||
|
.hidden(true)
|
||||||
|
.help("Set the width of the terminal"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("no-config")
|
||||||
|
.long("no-config")
|
||||||
|
.hidden(true)
|
||||||
|
.help("Do not use the configuration file"),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("config-file")
|
||||||
|
.long("config-file")
|
||||||
|
.conflicts_with("list-languages")
|
||||||
|
.conflicts_with("list-themes")
|
||||||
|
.hidden(true)
|
||||||
|
.help("Show path to the configuration file."),
|
||||||
|
)
|
||||||
|
.subcommand(
|
||||||
|
SubCommand::with_name("cache")
|
||||||
|
.about("Modify the syntax-definition and theme cache")
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("init")
|
||||||
|
.long("init")
|
||||||
|
.short("i")
|
||||||
|
.help("Initialize the syntax/theme cache.")
|
||||||
|
.long_help(
|
||||||
|
"Initialize the syntax/theme cache by loading from the \
|
||||||
|
source directory (default: the configuration directory).",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("clear")
|
||||||
|
.long("clear")
|
||||||
|
.short("c")
|
||||||
|
.help("Remove the cached syntax definitions and themes."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("config-dir")
|
||||||
|
.long("config-dir")
|
||||||
|
.short("d")
|
||||||
|
.help("Show bat's configuration directory."),
|
||||||
|
)
|
||||||
|
.group(
|
||||||
|
ArgGroup::with_name("cache-actions")
|
||||||
|
.args(&["init", "clear", "config-dir"])
|
||||||
|
.required(arg_group_required),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("source")
|
||||||
|
.long("source")
|
||||||
|
.requires("init")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("dir")
|
||||||
|
.help("Use a different directory to load syntaxes and themes from."),
|
||||||
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("target")
|
||||||
|
.long("target")
|
||||||
|
.requires("init")
|
||||||
|
.takes_value(true)
|
||||||
|
.value_name("dir")
|
||||||
|
.help(
|
||||||
|
"Use a different directory to store the cached syntax and theme set.",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.arg(Arg::with_name("blank").long("blank").requires("init").help(
|
||||||
|
"Create completely new syntax and theme sets \
|
||||||
|
(instead of appending to the default sets).",
|
||||||
|
)),
|
||||||
|
)
|
||||||
|
.help_message("Print this help message.")
|
||||||
|
.version_message("Show version information.")
|
||||||
|
}
|
||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
use std::env;
|
||||||
|
use std::ffi::OsString;
|
||||||
|
use std::fs;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
use shell_words;
|
||||||
|
|
||||||
|
use dirs::PROJECT_DIRS;
|
||||||
|
use util::transpose;
|
||||||
|
|
||||||
|
pub fn config_file() -> PathBuf {
|
||||||
|
PROJECT_DIRS.config_dir().join("config")
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_args_from_config_file() -> Result<Vec<OsString>, shell_words::ParseError> {
|
||||||
|
Ok(transpose(
|
||||||
|
fs::read_to_string(config_file())
|
||||||
|
.ok()
|
||||||
|
.map(|content| get_args_from_str(&content)),
|
||||||
|
)?
|
||||||
|
.unwrap_or(vec![]))
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_args_from_env_var() -> Option<Result<Vec<OsString>, shell_words::ParseError>> {
|
||||||
|
env::var("BAT_OPTS").ok().map(|s| get_args_from_str(&s))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn get_args_from_str<'a>(content: &'a str) -> Result<Vec<OsString>, shell_words::ParseError> {
|
||||||
|
let args_per_line = content
|
||||||
|
.split('\n')
|
||||||
|
.map(|line| line.trim())
|
||||||
|
.filter(|line| !line.is_empty())
|
||||||
|
.filter(|line| !line.starts_with("#"))
|
||||||
|
.map(|line| shell_words::split(line))
|
||||||
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
|
Ok(args_per_line
|
||||||
|
.iter()
|
||||||
|
.flatten()
|
||||||
|
.map(|line| line.into())
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn empty() {
|
||||||
|
let args = get_args_from_str("").unwrap();
|
||||||
|
assert!(args.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn single() {
|
||||||
|
assert_eq!(vec!["--plain"], get_args_from_str("--plain").unwrap());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn multiple() {
|
||||||
|
assert_eq!(
|
||||||
|
vec!["--plain", "--language=cpp"],
|
||||||
|
get_args_from_str("--plain --language=cpp").unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn quotes() {
|
||||||
|
assert_eq!(
|
||||||
|
vec!["--theme", "Sublime Snazzy"],
|
||||||
|
get_args_from_str("--theme \"Sublime Snazzy\"").unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn multi_line() {
|
||||||
|
let config = "
|
||||||
|
-p
|
||||||
|
--style numbers,changes
|
||||||
|
|
||||||
|
--color=always
|
||||||
|
";
|
||||||
|
assert_eq!(
|
||||||
|
vec!["-p", "--style", "numbers,changes", "--color=always"],
|
||||||
|
get_args_from_str(config).unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn comments() {
|
||||||
|
let config = "
|
||||||
|
# plain style
|
||||||
|
-p
|
||||||
|
|
||||||
|
# show line numbers and Git modifications
|
||||||
|
--style numbers,changes
|
||||||
|
|
||||||
|
# Always show ANSI colors
|
||||||
|
--color=always
|
||||||
|
";
|
||||||
|
assert_eq!(
|
||||||
|
vec!["-p", "--style", "numbers,changes", "--color=always"],
|
||||||
|
get_args_from_str(config).unwrap()
|
||||||
|
);
|
||||||
|
}
|
||||||
+52
-48
@@ -1,15 +1,13 @@
|
|||||||
use std::fs::File;
|
use std::io::{self, Write};
|
||||||
use std::io::{self, BufRead, BufReader, Write};
|
|
||||||
|
|
||||||
use app::{Config, InputFile};
|
use app::Config;
|
||||||
use assets::HighlightingAssets;
|
use assets::HighlightingAssets;
|
||||||
use errors::*;
|
use errors::*;
|
||||||
|
use inputfile::{InputFile, InputFileReader};
|
||||||
use line_range::LineRange;
|
use line_range::LineRange;
|
||||||
use output::OutputType;
|
use output::OutputType;
|
||||||
use printer::{InteractivePrinter, Printer, SimplePrinter};
|
use printer::{InteractivePrinter, Printer, SimplePrinter};
|
||||||
|
|
||||||
const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");
|
|
||||||
|
|
||||||
pub struct Controller<'a> {
|
pub struct Controller<'a> {
|
||||||
config: &'a Config<'a>,
|
config: &'a Config<'a>,
|
||||||
assets: &'a HighlightingAssets,
|
assets: &'a HighlightingAssets,
|
||||||
@@ -21,22 +19,37 @@ impl<'b> Controller<'b> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn run(&self) -> Result<bool> {
|
pub fn run(&self) -> Result<bool> {
|
||||||
let mut output_type = OutputType::from_mode(self.config.paging_mode);
|
let mut output_type = OutputType::from_mode(self.config.paging_mode)?;
|
||||||
let writer = output_type.handle()?;
|
let writer = output_type.handle()?;
|
||||||
let mut no_errors: bool = true;
|
let mut no_errors: bool = true;
|
||||||
|
|
||||||
for filename in &self.config.files {
|
let stdin = io::stdin();
|
||||||
let result = if self.config.loop_through {
|
|
||||||
let mut printer = SimplePrinter::new();
|
|
||||||
self.print_file(&mut printer, writer, *filename)
|
|
||||||
} else {
|
|
||||||
let mut printer = InteractivePrinter::new(&self.config, &self.assets, *filename);
|
|
||||||
self.print_file(&mut printer, writer, *filename)
|
|
||||||
};
|
|
||||||
|
|
||||||
if let Err(error) = result {
|
for input_file in &self.config.files {
|
||||||
handle_error(&error);
|
match input_file.get_reader(&stdin) {
|
||||||
no_errors = false;
|
Err(error) => {
|
||||||
|
handle_error(&error);
|
||||||
|
no_errors = false;
|
||||||
|
}
|
||||||
|
Ok(mut reader) => {
|
||||||
|
let result = if self.config.loop_through {
|
||||||
|
let mut printer = SimplePrinter::new();
|
||||||
|
self.print_file(reader, &mut printer, writer, *input_file)
|
||||||
|
} else {
|
||||||
|
let mut printer = InteractivePrinter::new(
|
||||||
|
&self.config,
|
||||||
|
&self.assets,
|
||||||
|
*input_file,
|
||||||
|
&mut reader,
|
||||||
|
);
|
||||||
|
self.print_file(reader, &mut printer, writer, *input_file)
|
||||||
|
};
|
||||||
|
|
||||||
|
if let Err(error) = result {
|
||||||
|
handle_error(&error);
|
||||||
|
no_errors = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,22 +58,15 @@ impl<'b> Controller<'b> {
|
|||||||
|
|
||||||
fn print_file<'a, P: Printer>(
|
fn print_file<'a, P: Printer>(
|
||||||
&self,
|
&self,
|
||||||
|
reader: InputFileReader,
|
||||||
printer: &mut P,
|
printer: &mut P,
|
||||||
writer: &mut Write,
|
writer: &mut Write,
|
||||||
filename: InputFile<'a>,
|
input_file: InputFile<'a>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let stdin = io::stdin();
|
printer.print_header(writer, input_file)?;
|
||||||
{
|
self.print_file_ranges(printer, writer, reader, &self.config.line_range)?;
|
||||||
let reader: Box<BufRead> = match filename {
|
printer.print_footer(writer)?;
|
||||||
InputFile::StdIn => Box::new(stdin.lock()),
|
|
||||||
InputFile::Ordinary(filename) => Box::new(BufReader::new(File::open(filename)?)),
|
|
||||||
InputFile::ThemePreviewFile => Box::new(THEME_PREVIEW_FILE),
|
|
||||||
};
|
|
||||||
|
|
||||||
printer.print_header(writer, filename)?;
|
|
||||||
self.print_file_ranges(printer, writer, reader, &self.config.line_range)?;
|
|
||||||
printer.print_footer(writer)?;
|
|
||||||
}
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,35 +74,33 @@ impl<'b> Controller<'b> {
|
|||||||
&self,
|
&self,
|
||||||
printer: &mut P,
|
printer: &mut P,
|
||||||
writer: &mut Write,
|
writer: &mut Write,
|
||||||
mut reader: Box<BufRead + 'a>,
|
mut reader: InputFileReader,
|
||||||
line_ranges: &Option<LineRange>,
|
line_ranges: &Option<LineRange>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let mut line_buffer = Vec::new();
|
let mut line_buffer = Vec::new();
|
||||||
|
|
||||||
let mut line_number: usize = 1;
|
let mut line_number: usize = 1;
|
||||||
|
|
||||||
while reader.read_until(b'\n', &mut line_buffer)? > 0 {
|
while reader.read_line(&mut line_buffer)? {
|
||||||
{
|
match line_ranges {
|
||||||
match line_ranges {
|
&Some(ref range) => {
|
||||||
&Some(ref range) => {
|
if line_number < range.lower {
|
||||||
if line_number < range.lower {
|
// Call the printer in case we need to call the syntax highlighter
|
||||||
// Call the printer in case we need to call the syntax highlighter
|
// for this line. However, set `out_of_range` to `true`.
|
||||||
// for this line. However, set `out_of_range` to `true`.
|
printer.print_line(true, writer, line_number, &line_buffer)?;
|
||||||
printer.print_line(true, writer, line_number, &line_buffer)?;
|
} else if line_number > range.upper {
|
||||||
} else if line_number > range.upper {
|
// no more lines in range, exit early
|
||||||
// no more lines in range, exit early
|
break;
|
||||||
break;
|
} else {
|
||||||
} else {
|
|
||||||
printer.print_line(false, writer, line_number, &line_buffer)?;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
&None => {
|
|
||||||
printer.print_line(false, writer, line_number, &line_buffer)?;
|
printer.print_line(false, writer, line_number, &line_buffer)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&None => {
|
||||||
line_number += 1;
|
printer.print_line(false, writer, line_number, &line_buffer)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
line_number += 1;
|
||||||
line_buffer.clear();
|
line_buffer.clear();
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
+7
-4
@@ -15,11 +15,14 @@ pub type LineChanges = HashMap<u32, LineChange>;
|
|||||||
|
|
||||||
pub fn get_git_diff(filename: &str) -> Option<LineChanges> {
|
pub fn get_git_diff(filename: &str) -> Option<LineChanges> {
|
||||||
let repo = Repository::discover(&filename).ok()?;
|
let repo = Repository::discover(&filename).ok()?;
|
||||||
let path_absolute = fs::canonicalize(&filename).ok()?;
|
|
||||||
let path_relative_to_repo = path_absolute.strip_prefix(repo.workdir()?).ok()?;
|
let repo_path_absolute = fs::canonicalize(repo.workdir()?).ok()?;
|
||||||
|
|
||||||
|
let filepath_absolute = fs::canonicalize(&filename).ok()?;
|
||||||
|
let filepath_relative_to_repo = filepath_absolute.strip_prefix(&repo_path_absolute).ok()?;
|
||||||
|
|
||||||
let mut diff_options = DiffOptions::new();
|
let mut diff_options = DiffOptions::new();
|
||||||
let pathspec = path_relative_to_repo.into_c_string().ok()?;
|
let pathspec = filepath_relative_to_repo.into_c_string().ok()?;
|
||||||
diff_options.pathspec(pathspec);
|
diff_options.pathspec(pathspec);
|
||||||
diff_options.context_lines(0);
|
diff_options.context_lines(0);
|
||||||
|
|
||||||
@@ -42,7 +45,7 @@ pub fn get_git_diff(filename: &str) -> Option<LineChanges> {
|
|||||||
Some(&mut |delta, hunk| {
|
Some(&mut |delta, hunk| {
|
||||||
let path = delta.new_file().path().unwrap_or_else(|| Path::new(""));
|
let path = delta.new_file().path().unwrap_or_else(|| Path::new(""));
|
||||||
|
|
||||||
if path_relative_to_repo != path {
|
if filepath_relative_to_repo != path {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
use directories::ProjectDirs;
|
||||||
|
|
||||||
|
lazy_static! {
|
||||||
|
pub static ref PROJECT_DIRS: ProjectDirs =
|
||||||
|
ProjectDirs::from("", "", crate_name!()).expect("Could not get home directory");
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
use std::fs::File;
|
||||||
|
use std::io::{self, BufRead, BufReader};
|
||||||
|
|
||||||
|
use content_inspector::{self, ContentType};
|
||||||
|
|
||||||
|
use errors::*;
|
||||||
|
|
||||||
|
const THEME_PREVIEW_FILE: &[u8] = include_bytes!("../assets/theme_preview.rs");
|
||||||
|
|
||||||
|
pub struct InputFileReader<'a> {
|
||||||
|
inner: Box<dyn BufRead + 'a>,
|
||||||
|
pub first_line: Vec<u8>,
|
||||||
|
pub content_type: ContentType,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> InputFileReader<'a> {
|
||||||
|
fn new<R: BufRead + 'a>(mut reader: R) -> InputFileReader<'a> {
|
||||||
|
let mut first_line = vec![];
|
||||||
|
reader.read_until(b'\n', &mut first_line).ok();
|
||||||
|
|
||||||
|
let content_type = content_inspector::inspect(&first_line[..]);
|
||||||
|
|
||||||
|
if content_type == ContentType::UTF_16LE {
|
||||||
|
reader.read_until(0x00, &mut first_line).ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
InputFileReader {
|
||||||
|
inner: Box::new(reader),
|
||||||
|
first_line,
|
||||||
|
content_type,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read_line(&mut self, buf: &mut Vec<u8>) -> io::Result<bool> {
|
||||||
|
if self.first_line.is_empty() {
|
||||||
|
let res = self.inner.read_until(b'\n', buf).map(|size| size > 0)?;
|
||||||
|
|
||||||
|
if self.content_type == ContentType::UTF_16LE {
|
||||||
|
self.inner.read_until(0x00, buf).ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
|
} else {
|
||||||
|
buf.append(&mut self.first_line);
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
|
pub enum InputFile<'a> {
|
||||||
|
StdIn,
|
||||||
|
Ordinary(&'a str),
|
||||||
|
ThemePreviewFile,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> InputFile<'a> {
|
||||||
|
pub fn get_reader(&self, stdin: &'a io::Stdin) -> Result<InputFileReader> {
|
||||||
|
match self {
|
||||||
|
InputFile::StdIn => Ok(InputFileReader::new(stdin.lock())),
|
||||||
|
InputFile::Ordinary(filename) => {
|
||||||
|
let file = File::open(filename)?;
|
||||||
|
|
||||||
|
if file.metadata()?.is_dir() {
|
||||||
|
return Err(format!("'{}' is a directory.", filename).into());
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(InputFileReader::new(BufReader::new(file)))
|
||||||
|
}
|
||||||
|
InputFile::ThemePreviewFile => Ok(InputFileReader::new(THEME_PREVIEW_FILE)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn basic() {
|
||||||
|
let content = b"#!/bin/bash\necho hello";
|
||||||
|
let mut reader = InputFileReader::new(&content[..]);
|
||||||
|
|
||||||
|
assert_eq!(b"#!/bin/bash\n", &reader.first_line[..]);
|
||||||
|
|
||||||
|
let mut buffer = vec![];
|
||||||
|
|
||||||
|
let res = reader.read_line(&mut buffer);
|
||||||
|
assert!(res.is_ok());
|
||||||
|
assert_eq!(true, res.unwrap());
|
||||||
|
assert_eq!(b"#!/bin/bash\n", &buffer[..]);
|
||||||
|
|
||||||
|
buffer.clear();
|
||||||
|
|
||||||
|
let res = reader.read_line(&mut buffer);
|
||||||
|
assert!(res.is_ok());
|
||||||
|
assert_eq!(true, res.unwrap());
|
||||||
|
assert_eq!(b"echo hello", &buffer[..]);
|
||||||
|
|
||||||
|
buffer.clear();
|
||||||
|
|
||||||
|
let res = reader.read_line(&mut buffer);
|
||||||
|
assert!(res.is_ok());
|
||||||
|
assert_eq!(false, res.unwrap());
|
||||||
|
assert!(buffer.is_empty());
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn utf16le() {
|
||||||
|
let content = b"\xFF\xFE\x73\x00\x0A\x00\x64\x00";
|
||||||
|
let mut reader = InputFileReader::new(&content[..]);
|
||||||
|
|
||||||
|
assert_eq!(b"\xFF\xFE\x73\x00\x0A\x00", &reader.first_line[..]);
|
||||||
|
|
||||||
|
let mut buffer = vec![];
|
||||||
|
|
||||||
|
let res = reader.read_line(&mut buffer);
|
||||||
|
assert!(res.is_ok());
|
||||||
|
assert_eq!(true, res.unwrap());
|
||||||
|
assert_eq!(b"\xFF\xFE\x73\x00\x0A\x00", &buffer[..]);
|
||||||
|
|
||||||
|
buffer.clear();
|
||||||
|
|
||||||
|
let res = reader.read_line(&mut buffer);
|
||||||
|
assert!(res.is_ok());
|
||||||
|
assert_eq!(true, res.unwrap());
|
||||||
|
assert_eq!(b"\x64\x00", &buffer[..]);
|
||||||
|
|
||||||
|
buffer.clear();
|
||||||
|
|
||||||
|
let res = reader.read_line(&mut buffer);
|
||||||
|
assert!(res.is_ok());
|
||||||
|
assert_eq!(false, res.unwrap());
|
||||||
|
assert!(buffer.is_empty());
|
||||||
|
}
|
||||||
+84
-23
@@ -13,32 +13,46 @@ extern crate lazy_static;
|
|||||||
extern crate ansi_term;
|
extern crate ansi_term;
|
||||||
extern crate atty;
|
extern crate atty;
|
||||||
extern crate console;
|
extern crate console;
|
||||||
|
extern crate content_inspector;
|
||||||
extern crate directories;
|
extern crate directories;
|
||||||
|
extern crate encoding;
|
||||||
extern crate git2;
|
extern crate git2;
|
||||||
|
extern crate shell_words;
|
||||||
extern crate syntect;
|
extern crate syntect;
|
||||||
|
extern crate wild;
|
||||||
|
|
||||||
mod app;
|
mod app;
|
||||||
mod assets;
|
mod assets;
|
||||||
|
mod clap_app;
|
||||||
|
mod config;
|
||||||
mod controller;
|
mod controller;
|
||||||
mod decorations;
|
mod decorations;
|
||||||
mod diff;
|
mod diff;
|
||||||
|
mod dirs;
|
||||||
|
mod inputfile;
|
||||||
mod line_range;
|
mod line_range;
|
||||||
mod output;
|
mod output;
|
||||||
|
mod preprocessor;
|
||||||
mod printer;
|
mod printer;
|
||||||
mod style;
|
mod style;
|
||||||
|
mod syntax_mapping;
|
||||||
mod terminal;
|
mod terminal;
|
||||||
|
mod util;
|
||||||
|
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
use std::io;
|
use std::io;
|
||||||
|
use std::io::Write;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
use std::process;
|
use std::process;
|
||||||
|
|
||||||
use ansi_term::Colour::Green;
|
use ansi_term::Colour::Green;
|
||||||
use ansi_term::Style;
|
use ansi_term::Style;
|
||||||
|
|
||||||
use app::{App, Config, InputFile};
|
use app::{App, Config};
|
||||||
use assets::{clear_assets, config_dir, HighlightingAssets};
|
use assets::{clear_assets, config_dir, HighlightingAssets};
|
||||||
|
use config::config_file;
|
||||||
use controller::Controller;
|
use controller::Controller;
|
||||||
|
use inputfile::InputFile;
|
||||||
use style::{OutputComponent, OutputComponents};
|
use style::{OutputComponent, OutputComponents};
|
||||||
|
|
||||||
mod errors {
|
mod errors {
|
||||||
@@ -80,13 +94,14 @@ fn run_cache_subcommand(matches: &clap::ArgMatches) -> Result<()> {
|
|||||||
} else if matches.is_present("clear") {
|
} else if matches.is_present("clear") {
|
||||||
clear_assets();
|
clear_assets();
|
||||||
} else if matches.is_present("config-dir") {
|
} else if matches.is_present("config-dir") {
|
||||||
println!("{}", config_dir());
|
writeln!(io::stdout(), "{}", config_dir())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn list_languages(assets: &HighlightingAssets, term_width: usize) {
|
pub fn list_languages(config: &Config) -> Result<()> {
|
||||||
|
let assets = HighlightingAssets::new();
|
||||||
let mut languages = assets
|
let mut languages = assets
|
||||||
.syntax_set
|
.syntax_set
|
||||||
.syntaxes()
|
.syntaxes()
|
||||||
@@ -104,10 +119,19 @@ pub fn list_languages(assets: &HighlightingAssets, term_width: usize) {
|
|||||||
let comma_separator = ", ";
|
let comma_separator = ", ";
|
||||||
let separator = " ";
|
let separator = " ";
|
||||||
// Line-wrapping for the possible file extension overflow.
|
// Line-wrapping for the possible file extension overflow.
|
||||||
let desired_width = term_width - longest - separator.len();
|
let desired_width = config.term_width - longest - separator.len();
|
||||||
|
|
||||||
|
let stdout = io::stdout();
|
||||||
|
let mut stdout = stdout.lock();
|
||||||
|
|
||||||
|
let style = if config.colored_output {
|
||||||
|
Green.normal()
|
||||||
|
} else {
|
||||||
|
Style::default()
|
||||||
|
};
|
||||||
|
|
||||||
for lang in languages {
|
for lang in languages {
|
||||||
print!("{:width$}{}", lang.name, separator, width = longest);
|
write!(stdout, "{:width$}{}", lang.name, separator, width = longest)?;
|
||||||
|
|
||||||
// Number of characters on this line so far, wrap before `desired_width`
|
// Number of characters on this line so far, wrap before `desired_width`
|
||||||
let mut num_chars = 0;
|
let mut num_chars = 0;
|
||||||
@@ -118,59 +142,96 @@ pub fn list_languages(assets: &HighlightingAssets, term_width: usize) {
|
|||||||
let new_chars = word.len() + comma_separator.len();
|
let new_chars = word.len() + comma_separator.len();
|
||||||
if num_chars + new_chars >= desired_width {
|
if num_chars + new_chars >= desired_width {
|
||||||
num_chars = 0;
|
num_chars = 0;
|
||||||
print!("\n{:width$}{}", "", separator, width = longest);
|
write!(stdout, "\n{:width$}{}", "", separator, width = longest)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
num_chars += new_chars;
|
num_chars += new_chars;
|
||||||
print!("{}", Green.paint(&word[..]));
|
write!(stdout, "{}", style.paint(&word[..]))?;
|
||||||
if extension.peek().is_some() {
|
if extension.peek().is_some() {
|
||||||
print!("{}", comma_separator);
|
write!(stdout, "{}", comma_separator)?;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
println!();
|
writeln!(stdout)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn list_themes(assets: &HighlightingAssets, cfg: &Config) {
|
pub fn list_themes(cfg: &Config) -> Result<()> {
|
||||||
|
let assets = HighlightingAssets::new();
|
||||||
let themes = &assets.theme_set.themes;
|
let themes = &assets.theme_set.themes;
|
||||||
let mut config = cfg.clone();
|
let mut config = cfg.clone();
|
||||||
let mut style = HashSet::new();
|
let mut style = HashSet::new();
|
||||||
style.insert(OutputComponent::Plain);
|
style.insert(OutputComponent::Plain);
|
||||||
config.files = vec![InputFile::ThemePreviewFile];
|
config.files = vec![InputFile::ThemePreviewFile];
|
||||||
config.output_components = OutputComponents(style);
|
config.output_components = OutputComponents(style);
|
||||||
for (theme, _) in themes.iter() {
|
|
||||||
println!("Theme: {}\n", Style::new().bold().paint(theme.to_string()));
|
let stdout = io::stdout();
|
||||||
config.theme = theme.to_string();
|
let mut stdout = stdout.lock();
|
||||||
let _controller = Controller::new(&config, &assets).run();
|
|
||||||
println!()
|
if config.colored_output {
|
||||||
|
for (theme, _) in themes.iter() {
|
||||||
|
writeln!(
|
||||||
|
stdout,
|
||||||
|
"Theme: {}\n",
|
||||||
|
Style::new().bold().paint(theme.to_string())
|
||||||
|
)?;
|
||||||
|
config.theme = theme.to_string();
|
||||||
|
let _controller = Controller::new(&config, &assets).run();
|
||||||
|
writeln!(stdout)?;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (theme, _) in themes.iter() {
|
||||||
|
writeln!(stdout, "{}", theme)?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
fn run_controller(config: &Config) -> Result<bool> {
|
||||||
|
let assets = HighlightingAssets::new();
|
||||||
|
let controller = Controller::new(&config, &assets);
|
||||||
|
controller.run()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns `Err(..)` upon fatal errors. Otherwise, returns `Some(true)` on full success and
|
/// Returns `Err(..)` upon fatal errors. Otherwise, returns `Some(true)` on full success and
|
||||||
/// `Some(false)` if any intermediate errors occurred (were printed).
|
/// `Some(false)` if any intermediate errors occurred (were printed).
|
||||||
fn run() -> Result<bool> {
|
fn run() -> Result<bool> {
|
||||||
let app = App::new();
|
let app = App::new()?;
|
||||||
|
|
||||||
match app.matches.subcommand() {
|
match app.matches.subcommand() {
|
||||||
("cache", Some(cache_matches)) => {
|
("cache", Some(cache_matches)) => {
|
||||||
run_cache_subcommand(cache_matches)?;
|
// If there is a file named 'cache' in the current working directory,
|
||||||
Ok(true)
|
// arguments for subcommand 'cache' are not mandatory.
|
||||||
|
// If there are non-zero arguments, execute the subcommand cache, else, open the file cache.
|
||||||
|
if !cache_matches.args.is_empty() {
|
||||||
|
run_cache_subcommand(cache_matches)?;
|
||||||
|
Ok(true)
|
||||||
|
} else {
|
||||||
|
let mut config = app.config()?;
|
||||||
|
config.files = vec![InputFile::Ordinary(&"cache")];
|
||||||
|
|
||||||
|
run_controller(&config)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let config = app.config()?;
|
let config = app.config()?;
|
||||||
let assets = HighlightingAssets::new();
|
|
||||||
|
|
||||||
if app.matches.is_present("list-languages") {
|
if app.matches.is_present("list-languages") {
|
||||||
list_languages(&assets, config.term_width);
|
list_languages(&config)?;
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else if app.matches.is_present("list-themes") {
|
} else if app.matches.is_present("list-themes") {
|
||||||
list_themes(&assets, &config);
|
list_themes(&config)?;
|
||||||
|
|
||||||
|
Ok(true)
|
||||||
|
} else if app.matches.is_present("config-file") {
|
||||||
|
println!("{}", config_file().to_string_lossy());
|
||||||
|
|
||||||
Ok(true)
|
Ok(true)
|
||||||
} else {
|
} else {
|
||||||
let controller = Controller::new(&config, &assets);
|
run_controller(&config)
|
||||||
controller.run()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+40
-23
@@ -1,7 +1,11 @@
|
|||||||
use std::env;
|
use std::env;
|
||||||
|
use std::ffi::OsString;
|
||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
use std::path::PathBuf;
|
||||||
use std::process::{Child, Command, Stdio};
|
use std::process::{Child, Command, Stdio};
|
||||||
|
|
||||||
|
use shell_words;
|
||||||
|
|
||||||
use app::PagingMode;
|
use app::PagingMode;
|
||||||
use errors::*;
|
use errors::*;
|
||||||
|
|
||||||
@@ -11,39 +15,52 @@ pub enum OutputType {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl OutputType {
|
impl OutputType {
|
||||||
pub fn from_mode(mode: PagingMode) -> Self {
|
pub fn from_mode(mode: PagingMode) -> Result<Self> {
|
||||||
use self::PagingMode::*;
|
use self::PagingMode::*;
|
||||||
match mode {
|
Ok(match mode {
|
||||||
Always => OutputType::try_pager(false),
|
Always => OutputType::try_pager(false)?,
|
||||||
QuitIfOneScreen => OutputType::try_pager(true),
|
QuitIfOneScreen => OutputType::try_pager(true)?,
|
||||||
_ => OutputType::stdout(),
|
_ => OutputType::stdout(),
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to launch the pager. Fall back to stdout in case of errors.
|
/// Try to launch the pager. Fall back to stdout in case of errors.
|
||||||
fn try_pager(quit_if_one_screen: bool) -> Self {
|
fn try_pager(quit_if_one_screen: bool) -> Result<Self> {
|
||||||
let pager = env::var("BAT_PAGER")
|
let pager = env::var("BAT_PAGER")
|
||||||
.or_else(|_| env::var("PAGER"))
|
.or_else(|_| env::var("PAGER"))
|
||||||
.unwrap_or(String::from("less"));
|
.unwrap_or(String::from("less"));
|
||||||
|
|
||||||
let mut process = if pager == "less" {
|
let pagerflags = shell_words::split(&pager)
|
||||||
let mut args = vec!["--RAW-CONTROL-CHARS", "--no-init"];
|
.chain_err(|| "Could not parse (BAT_)PAGER environment variable.")?;
|
||||||
if quit_if_one_screen {
|
|
||||||
args.push("--quit-if-one-screen");
|
match pagerflags.split_first() {
|
||||||
|
Some((pager_name, args)) => {
|
||||||
|
let pager_path = PathBuf::from(pager_name);
|
||||||
|
let is_less = pager_path.file_stem() == Some(&OsString::from("less"));
|
||||||
|
|
||||||
|
let mut process = if is_less {
|
||||||
|
let mut p = Command::new(&pager_path);
|
||||||
|
if args.is_empty() {
|
||||||
|
p.args(vec!["--RAW-CONTROL-CHARS", "--no-init"]);
|
||||||
|
if quit_if_one_screen {
|
||||||
|
p.arg("--quit-if-one-screen");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
p.env("LESSCHARSET", "UTF-8");
|
||||||
|
p
|
||||||
|
} else {
|
||||||
|
Command::new(&pager_path)
|
||||||
|
};
|
||||||
|
|
||||||
|
Ok(process
|
||||||
|
.args(args)
|
||||||
|
.stdin(Stdio::piped())
|
||||||
|
.spawn()
|
||||||
|
.map(OutputType::Pager)
|
||||||
|
.unwrap_or_else(|_| OutputType::stdout()))
|
||||||
}
|
}
|
||||||
|
None => Ok(OutputType::stdout()),
|
||||||
let mut p = Command::new("less");
|
}
|
||||||
p.args(&args).env("LESSCHARSET", "UTF-8");
|
|
||||||
p
|
|
||||||
} else {
|
|
||||||
Command::new(pager)
|
|
||||||
};
|
|
||||||
|
|
||||||
process
|
|
||||||
.stdin(Stdio::piped())
|
|
||||||
.spawn()
|
|
||||||
.map(OutputType::Pager)
|
|
||||||
.unwrap_or_else(|_| OutputType::stdout())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn stdout() -> Self {
|
fn stdout() -> Self {
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
use console::AnsiCodeIterator;
|
||||||
|
|
||||||
|
/// Expand tabs like an ANSI-enabled expand(1).
|
||||||
|
pub fn expand(line: &str, width: usize, cursor: &mut usize) -> String {
|
||||||
|
let mut buffer = String::with_capacity(line.len() * 2);
|
||||||
|
|
||||||
|
for chunk in AnsiCodeIterator::new(line) {
|
||||||
|
match chunk {
|
||||||
|
(text, true) => buffer.push_str(text),
|
||||||
|
(mut text, false) => {
|
||||||
|
while let Some(index) = text.find('\t') {
|
||||||
|
// Add previous text.
|
||||||
|
if index > 0 {
|
||||||
|
*cursor += index;
|
||||||
|
buffer.push_str(&text[0..index]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add tab.
|
||||||
|
let spaces = width - (*cursor % width);
|
||||||
|
*cursor += spaces;
|
||||||
|
buffer.push_str(&*" ".repeat(spaces));
|
||||||
|
|
||||||
|
// Next.
|
||||||
|
text = &text[index + 1..text.len()];
|
||||||
|
}
|
||||||
|
|
||||||
|
*cursor += text.len();
|
||||||
|
buffer.push_str(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
buffer
|
||||||
|
}
|
||||||
+109
-34
@@ -1,4 +1,3 @@
|
|||||||
use std::boxed::Box;
|
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::vec::Vec;
|
use std::vec::Vec;
|
||||||
|
|
||||||
@@ -9,13 +8,21 @@ use console::AnsiCodeIterator;
|
|||||||
|
|
||||||
use syntect::easy::HighlightLines;
|
use syntect::easy::HighlightLines;
|
||||||
use syntect::highlighting::Theme;
|
use syntect::highlighting::Theme;
|
||||||
|
use syntect::parsing::SyntaxSet;
|
||||||
|
|
||||||
use app::{Config, InputFile};
|
use content_inspector::ContentType;
|
||||||
|
|
||||||
|
use encoding::all::{UTF_16BE, UTF_16LE};
|
||||||
|
use encoding::{DecoderTrap, Encoding};
|
||||||
|
|
||||||
|
use app::Config;
|
||||||
use assets::HighlightingAssets;
|
use assets::HighlightingAssets;
|
||||||
use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
|
use decorations::{Decoration, GridBorderDecoration, LineChangesDecoration, LineNumberDecoration};
|
||||||
use diff::get_git_diff;
|
use diff::get_git_diff;
|
||||||
use diff::LineChanges;
|
use diff::LineChanges;
|
||||||
use errors::*;
|
use errors::*;
|
||||||
|
use inputfile::{InputFile, InputFileReader};
|
||||||
|
use preprocessor::expand;
|
||||||
use style::OutputWrap;
|
use style::OutputWrap;
|
||||||
use terminal::{as_terminal_escaped, to_ansi_color};
|
use terminal::{as_terminal_escaped, to_ansi_color};
|
||||||
|
|
||||||
@@ -65,15 +72,22 @@ impl Printer for SimplePrinter {
|
|||||||
pub struct InteractivePrinter<'a> {
|
pub struct InteractivePrinter<'a> {
|
||||||
colors: Colors,
|
colors: Colors,
|
||||||
config: &'a Config<'a>,
|
config: &'a Config<'a>,
|
||||||
decorations: Vec<Box<Decoration>>,
|
decorations: Vec<Box<dyn Decoration>>,
|
||||||
panel_width: usize,
|
panel_width: usize,
|
||||||
ansi_prefix_sgr: String,
|
ansi_prefix_sgr: String,
|
||||||
|
content_type: ContentType,
|
||||||
pub line_changes: Option<LineChanges>,
|
pub line_changes: Option<LineChanges>,
|
||||||
highlighter: HighlightLines<'a>,
|
highlighter: Option<HighlightLines<'a>>,
|
||||||
|
syntax_set: &'a SyntaxSet,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> InteractivePrinter<'a> {
|
impl<'a> InteractivePrinter<'a> {
|
||||||
pub fn new(config: &'a Config, assets: &'a HighlightingAssets, file: InputFile) -> Self {
|
pub fn new(
|
||||||
|
config: &'a Config,
|
||||||
|
assets: &'a HighlightingAssets,
|
||||||
|
file: InputFile,
|
||||||
|
reader: &mut InputFileReader,
|
||||||
|
) -> Self {
|
||||||
let theme = assets.get_theme(&config.theme);
|
let theme = assets.get_theme(&config.theme);
|
||||||
|
|
||||||
let colors = if config.colored_output {
|
let colors = if config.colored_output {
|
||||||
@@ -83,7 +97,7 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create decorations.
|
// Create decorations.
|
||||||
let mut decorations: Vec<Box<Decoration>> = Vec::new();
|
let mut decorations: Vec<Box<dyn Decoration>> = Vec::new();
|
||||||
|
|
||||||
if config.output_components.numbers() {
|
if config.output_components.numbers() {
|
||||||
decorations.push(Box::new(LineNumberDecoration::new(&colors)));
|
decorations.push(Box::new(LineNumberDecoration::new(&colors)));
|
||||||
@@ -112,24 +126,36 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
panel_width = 0;
|
panel_width = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the Git modifications
|
let mut line_changes = None;
|
||||||
let line_changes = match file {
|
|
||||||
InputFile::Ordinary(filename) => get_git_diff(filename),
|
|
||||||
_ => None,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Determine the type of syntax for highlighting
|
let highlighter = if reader.content_type.is_binary() {
|
||||||
let syntax = assets.get_syntax(config.language, file);
|
None
|
||||||
let highlighter = HighlightLines::new(syntax, theme);
|
} else {
|
||||||
|
// Get the Git modifications
|
||||||
|
line_changes = if config.output_components.changes() {
|
||||||
|
match file {
|
||||||
|
InputFile::Ordinary(filename) => get_git_diff(filename),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
// Determine the type of syntax for highlighting
|
||||||
|
let syntax = assets.get_syntax(config.language, file, reader, &config.syntax_mapping);
|
||||||
|
Some(HighlightLines::new(syntax, theme))
|
||||||
|
};
|
||||||
|
|
||||||
InteractivePrinter {
|
InteractivePrinter {
|
||||||
panel_width,
|
panel_width,
|
||||||
colors,
|
colors,
|
||||||
config,
|
config,
|
||||||
decorations,
|
decorations,
|
||||||
|
content_type: reader.content_type,
|
||||||
ansi_prefix_sgr: String::new(),
|
ansi_prefix_sgr: String::new(),
|
||||||
line_changes,
|
line_changes,
|
||||||
highlighter,
|
highlighter,
|
||||||
|
syntax_set: &assets.syntax_set,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,6 +174,14 @@ impl<'a> InteractivePrinter<'a> {
|
|||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn preprocess(&self, text: &str, cursor: &mut usize) -> String {
|
||||||
|
if self.config.tab_width > 0 {
|
||||||
|
expand(text, self.config.tab_width, cursor)
|
||||||
|
} else {
|
||||||
|
text.to_string()
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> Printer for InteractivePrinter<'a> {
|
impl<'a> Printer for InteractivePrinter<'a> {
|
||||||
@@ -176,17 +210,34 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
_ => ("", "STDIN"),
|
_ => ("", "STDIN"),
|
||||||
};
|
};
|
||||||
|
|
||||||
writeln!(handle, "{}{}", prefix, self.colors.filename.paint(name))?;
|
let mode = match self.content_type {
|
||||||
|
ContentType::BINARY => " <BINARY>",
|
||||||
|
ContentType::UTF_16LE => " <UTF-16LE>",
|
||||||
|
ContentType::UTF_16BE => " <UTF-16BE>",
|
||||||
|
_ => "",
|
||||||
|
};
|
||||||
|
|
||||||
|
writeln!(
|
||||||
|
handle,
|
||||||
|
"{}{}{}",
|
||||||
|
prefix,
|
||||||
|
self.colors.filename.paint(name),
|
||||||
|
mode
|
||||||
|
)?;
|
||||||
|
|
||||||
if self.config.output_components.grid() {
|
if self.config.output_components.grid() {
|
||||||
self.print_horizontal_line(handle, '┼')?;
|
if self.content_type.is_text() {
|
||||||
|
self.print_horizontal_line(handle, '┼')?;
|
||||||
|
} else {
|
||||||
|
self.print_horizontal_line(handle, '┴')?;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_footer(&mut self, handle: &mut Write) -> Result<()> {
|
fn print_footer(&mut self, handle: &mut Write) -> Result<()> {
|
||||||
if self.config.output_components.grid() {
|
if self.config.output_components.grid() && self.content_type.is_text() {
|
||||||
self.print_horizontal_line(handle, '┴')
|
self.print_horizontal_line(handle, '┴')
|
||||||
} else {
|
} else {
|
||||||
Ok(())
|
Ok(())
|
||||||
@@ -200,8 +251,27 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
line_number: usize,
|
line_number: usize,
|
||||||
line_buffer: &[u8],
|
line_buffer: &[u8],
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let line = String::from_utf8_lossy(&line_buffer);
|
let line = match self.content_type {
|
||||||
let regions = self.highlighter.highlight(line.as_ref());
|
ContentType::BINARY => {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
ContentType::UTF_16LE => UTF_16LE
|
||||||
|
.decode(&line_buffer, DecoderTrap::Strict)
|
||||||
|
.unwrap_or("Invalid UTF-16LE".into()),
|
||||||
|
ContentType::UTF_16BE => UTF_16BE
|
||||||
|
.decode(&line_buffer, DecoderTrap::Strict)
|
||||||
|
.unwrap_or("Invalid UTF-16BE".into()),
|
||||||
|
_ => String::from_utf8_lossy(&line_buffer).to_string(),
|
||||||
|
};
|
||||||
|
let regions = {
|
||||||
|
let highlighter = match self.highlighter {
|
||||||
|
Some(ref mut highlighter) => highlighter,
|
||||||
|
_ => {
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
highlighter.highlight(line.as_ref(), self.syntax_set)
|
||||||
|
};
|
||||||
|
|
||||||
if out_of_range {
|
if out_of_range {
|
||||||
return Ok(());
|
return Ok(());
|
||||||
@@ -209,6 +279,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
|
|
||||||
let mut cursor: usize = 0;
|
let mut cursor: usize = 0;
|
||||||
let mut cursor_max: usize = self.config.term_width;
|
let mut cursor_max: usize = self.config.term_width;
|
||||||
|
let mut cursor_total: usize = 0;
|
||||||
let mut panel_wrap: Option<String> = None;
|
let mut panel_wrap: Option<String> = None;
|
||||||
|
|
||||||
// Line decorations.
|
// Line decorations.
|
||||||
@@ -230,19 +301,18 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
let true_color = self.config.true_color;
|
let true_color = self.config.true_color;
|
||||||
let colored_output = self.config.colored_output;
|
let colored_output = self.config.colored_output;
|
||||||
|
|
||||||
write!(
|
for &(style, region) in regions.iter() {
|
||||||
handle,
|
let text = &*self.preprocess(region, &mut cursor_total);
|
||||||
"{}",
|
write!(
|
||||||
regions
|
handle,
|
||||||
.iter()
|
"{}",
|
||||||
.map(|&(style, text)| as_terminal_escaped(
|
as_terminal_escaped(style, &*text, true_color, colored_output,)
|
||||||
style,
|
)?;
|
||||||
text,
|
}
|
||||||
true_color,
|
|
||||||
colored_output,
|
if line.bytes().next_back() != Some(b'\n') {
|
||||||
)).collect::<Vec<_>>()
|
write!(handle, "\n")?;
|
||||||
.join("")
|
}
|
||||||
)?;
|
|
||||||
} else {
|
} else {
|
||||||
for &(style, region) in regions.iter() {
|
for &(style, region) in regions.iter() {
|
||||||
let mut ansi_iterator = AnsiCodeIterator::new(region);
|
let mut ansi_iterator = AnsiCodeIterator::new(region);
|
||||||
@@ -265,7 +335,11 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
|
|
||||||
// Regular text.
|
// Regular text.
|
||||||
(text, false) => {
|
(text, false) => {
|
||||||
let text = text.trim_right_matches(|c| c == '\r' || c == '\n');
|
let text = self.preprocess(
|
||||||
|
text.trim_right_matches(|c| c == '\r' || c == '\n'),
|
||||||
|
&mut cursor_total,
|
||||||
|
);
|
||||||
|
|
||||||
let mut chars = text.chars();
|
let mut chars = text.chars();
|
||||||
let mut remaining = text.chars().count();
|
let mut remaining = text.chars().count();
|
||||||
|
|
||||||
@@ -302,7 +376,8 @@ impl<'a> Printer for InteractivePrinter<'a> {
|
|||||||
.iter()
|
.iter()
|
||||||
.map(|ref d| d
|
.map(|ref d| d
|
||||||
.generate(line_number, true, self)
|
.generate(line_number, true, self)
|
||||||
.text).collect::<Vec<String>>()
|
.text)
|
||||||
|
.collect::<Vec<String>>()
|
||||||
.join(" ")
|
.join(" ")
|
||||||
))
|
))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
+13
-6
@@ -23,11 +23,13 @@ pub enum OutputWrap {
|
|||||||
impl OutputComponent {
|
impl OutputComponent {
|
||||||
pub fn components(&self, interactive_terminal: bool) -> &'static [OutputComponent] {
|
pub fn components(&self, interactive_terminal: bool) -> &'static [OutputComponent] {
|
||||||
match *self {
|
match *self {
|
||||||
OutputComponent::Auto => if interactive_terminal {
|
OutputComponent::Auto => {
|
||||||
OutputComponent::Full.components(interactive_terminal)
|
if interactive_terminal {
|
||||||
} else {
|
OutputComponent::Full.components(interactive_terminal)
|
||||||
OutputComponent::Plain.components(interactive_terminal)
|
} else {
|
||||||
},
|
OutputComponent::Plain.components(interactive_terminal)
|
||||||
|
}
|
||||||
|
}
|
||||||
OutputComponent::Changes => &[OutputComponent::Changes],
|
OutputComponent::Changes => &[OutputComponent::Changes],
|
||||||
OutputComponent::Grid => &[OutputComponent::Grid],
|
OutputComponent::Grid => &[OutputComponent::Grid],
|
||||||
OutputComponent::Header => &[OutputComponent::Header],
|
OutputComponent::Header => &[OutputComponent::Header],
|
||||||
@@ -54,7 +56,8 @@ impl FromStr for OutputComponent {
|
|||||||
"header" => Ok(OutputComponent::Header),
|
"header" => Ok(OutputComponent::Header),
|
||||||
"numbers" => Ok(OutputComponent::Numbers),
|
"numbers" => Ok(OutputComponent::Numbers),
|
||||||
"full" => Ok(OutputComponent::Full),
|
"full" => Ok(OutputComponent::Full),
|
||||||
"plain" | _ => Ok(OutputComponent::Plain),
|
"plain" => Ok(OutputComponent::Plain),
|
||||||
|
_ => Err(format!("Unknown style '{}'", s).into()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,4 +81,8 @@ impl OutputComponents {
|
|||||||
pub fn numbers(&self) -> bool {
|
pub fn numbers(&self) -> bool {
|
||||||
self.0.contains(&OutputComponent::Numbers)
|
self.0.contains(&OutputComponent::Numbers)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn plain(&self) -> bool {
|
||||||
|
self.0.iter().all(|c| c == &OutputComponent::Plain)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
use std::borrow::Cow;
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
#[derive(Debug, Clone)]
|
||||||
|
pub struct SyntaxMapping(HashMap<String, String>);
|
||||||
|
|
||||||
|
impl SyntaxMapping {
|
||||||
|
pub fn new() -> SyntaxMapping {
|
||||||
|
SyntaxMapping(HashMap::new())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn insert(&mut self, from: String, to: String) -> Option<String> {
|
||||||
|
self.0.insert(from, to)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn replace<'a>(&self, input: &'a str) -> Cow<'a, str> {
|
||||||
|
let mut out = Cow::from(input);
|
||||||
|
if let Some(value) = self.0.get(input) {
|
||||||
|
out = Cow::from(value.clone())
|
||||||
|
}
|
||||||
|
out
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn basic() {
|
||||||
|
let mut map = SyntaxMapping::new();
|
||||||
|
map.insert("Cargo.lock".into(), "toml".into());
|
||||||
|
map.insert(".ignore".into(), ".gitignore".into());
|
||||||
|
|
||||||
|
assert_eq!("toml", map.replace("Cargo.lock"));
|
||||||
|
assert_eq!("other.lock", map.replace("other.lock"));
|
||||||
|
|
||||||
|
assert_eq!(".gitignore", map.replace(".ignore"));
|
||||||
|
}
|
||||||
+3
-44
@@ -1,32 +1,15 @@
|
|||||||
|
extern crate ansi_colours;
|
||||||
|
|
||||||
use ansi_term::Colour::{Fixed, RGB};
|
use ansi_term::Colour::{Fixed, RGB};
|
||||||
use ansi_term::{self, Style};
|
use ansi_term::{self, Style};
|
||||||
|
|
||||||
use syntect::highlighting::{self, FontStyle};
|
use syntect::highlighting::{self, FontStyle};
|
||||||
|
|
||||||
/// Approximate a 24 bit color value by a 8 bit ANSI code
|
|
||||||
fn rgb2ansi(r: u8, g: u8, b: u8) -> u8 {
|
|
||||||
const BLACK: u8 = 16;
|
|
||||||
const WHITE: u8 = 231;
|
|
||||||
|
|
||||||
if r == g && g == b {
|
|
||||||
if r < 8 {
|
|
||||||
BLACK
|
|
||||||
} else if r > 248 {
|
|
||||||
WHITE
|
|
||||||
} else {
|
|
||||||
((r - 8) as u16 * 24 / 247) as u8 + 232
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
36 * (r / 51) + 6 * (g / 51) + (b / 51) + 16
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term::Colour {
|
pub fn to_ansi_color(color: highlighting::Color, true_color: bool) -> ansi_term::Colour {
|
||||||
if true_color {
|
if true_color {
|
||||||
RGB(color.r, color.g, color.b)
|
RGB(color.r, color.g, color.b)
|
||||||
} else {
|
} else {
|
||||||
let ansi_code = rgb2ansi(color.r, color.g, color.b);
|
Fixed(ansi_colours::ansi256_from_rgb((color.r, color.g, color.b)))
|
||||||
Fixed(ansi_code)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,27 +37,3 @@ pub fn as_terminal_escaped(
|
|||||||
|
|
||||||
style.paint(text).to_string()
|
style.paint(text).to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_rgb2ansi_black_white() {
|
|
||||||
assert_eq!(16, rgb2ansi(0x00, 0x00, 0x00));
|
|
||||||
assert_eq!(231, rgb2ansi(0xff, 0xff, 0xff));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_rgb2ansi_gray() {
|
|
||||||
assert_eq!(241, rgb2ansi(0x6c, 0x6c, 0x6c));
|
|
||||||
assert_eq!(233, rgb2ansi(0x1c, 0x1c, 0x1c));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_rgb2ansi_color() {
|
|
||||||
assert_eq!(96, rgb2ansi(0x87, 0x5f, 0x87));
|
|
||||||
assert_eq!(141, rgb2ansi(0xaf, 0x87, 0xff));
|
|
||||||
assert_eq!(193, rgb2ansi(0xd7, 0xff, 0xaf));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_rgb2ansi_approx() {
|
|
||||||
assert_eq!(231, rgb2ansi(0xfe, 0xfe, 0xfe));
|
|
||||||
}
|
|
||||||
|
|||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
/// Helper function that might appear in Rust stable at some point
|
||||||
|
/// (https://doc.rust-lang.org/stable/std/option/enum.Option.html#method.transpose)
|
||||||
|
pub fn transpose<T, E>(opt: Option<Result<T, E>>) -> Result<Option<T>, E> {
|
||||||
|
opt.map_or(Ok(None), |res| res.map(Some))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests {
|
||||||
|
use super::transpose;
|
||||||
|
|
||||||
|
#[derive(Debug, PartialEq)]
|
||||||
|
struct TestError;
|
||||||
|
|
||||||
|
type TestResult<T> = Result<T, TestError>;
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn basic() {
|
||||||
|
let a: Option<TestResult<i32>> = Some(Ok(2));
|
||||||
|
assert_eq!(Ok(Some(2)), transpose(a));
|
||||||
|
|
||||||
|
let b: Option<TestResult<i32>> = Some(Err(TestError));
|
||||||
|
assert_eq!(Err(TestError), transpose(b));
|
||||||
|
|
||||||
|
let c: Option<TestResult<i32>> = None;
|
||||||
|
assert_eq!(Ok(None), transpose(c));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -10,6 +10,7 @@ SRC="test-src/jquery-3.3.1.js"
|
|||||||
|
|
||||||
|
|
||||||
cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
|
cmd_bat="bat --style=full --color=always --paging=never '$SRC'"
|
||||||
|
cmd_bat_simple="bat --plain --wrap=never --tabs=0 --color=always --paging=never '$SRC'"
|
||||||
cmd_pygmentize="pygmentize -g '$SRC'"
|
cmd_pygmentize="pygmentize -g '$SRC'"
|
||||||
cmd_highlight="highlight -O truecolor '$SRC'"
|
cmd_highlight="highlight -O truecolor '$SRC'"
|
||||||
cmd_ccat="ccat --color=always '$SRC'"
|
cmd_ccat="ccat --color=always '$SRC'"
|
||||||
@@ -20,6 +21,7 @@ cmd_rouge="rougify '$SRC'"
|
|||||||
|
|
||||||
hyperfine --warmup 3 \
|
hyperfine --warmup 3 \
|
||||||
"$cmd_bat" \
|
"$cmd_bat" \
|
||||||
|
"$cmd_bat_simple" \
|
||||||
"$cmd_pygmentize" \
|
"$cmd_pygmentize" \
|
||||||
"$cmd_highlight" \
|
"$cmd_highlight" \
|
||||||
"$cmd_ccat" \
|
"$cmd_ccat" \
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
line 1
|
||||||
|
line 2
|
||||||
|
line 3
|
||||||
|
line 4
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
hello world
|
||||||
@@ -0,0 +1,152 @@
|
|||||||
|
extern crate assert_cmd;
|
||||||
|
|
||||||
|
use assert_cmd::prelude::*;
|
||||||
|
use std::process::Command;
|
||||||
|
|
||||||
|
fn bat() -> Command {
|
||||||
|
let mut cmd = Command::main_binary().unwrap();
|
||||||
|
cmd.current_dir("tests/examples");
|
||||||
|
cmd.arg("--no-config");
|
||||||
|
cmd.env_remove("PAGER");
|
||||||
|
cmd.env_remove("BAT_PAGER");
|
||||||
|
cmd
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn basic() {
|
||||||
|
bat()
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("hello world\n")
|
||||||
|
.stderr("");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn stdin() {
|
||||||
|
bat()
|
||||||
|
.with_stdin()
|
||||||
|
.buffer("foo\nbar\n")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("foo\nbar\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn concatenate() {
|
||||||
|
bat()
|
||||||
|
.arg("test.txt")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("hello world\nhello world\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn concatenate_stdin() {
|
||||||
|
bat()
|
||||||
|
.arg("test.txt")
|
||||||
|
.arg("-")
|
||||||
|
.arg("test.txt")
|
||||||
|
.with_stdin()
|
||||||
|
.buffer("stdin\n")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("hello world\nstdin\nhello world\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn line_numbers() {
|
||||||
|
bat()
|
||||||
|
.arg("multiline.txt")
|
||||||
|
.arg("--style=numbers")
|
||||||
|
.arg("--decorations=always")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout(" 1 line 1\n 2 line 2\n 3 line 3\n 4 line 4\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn line_range_2_3() {
|
||||||
|
bat()
|
||||||
|
.arg("multiline.txt")
|
||||||
|
.arg("--line-range=2:3")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("line 2\nline 3\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn line_range_first_two() {
|
||||||
|
bat()
|
||||||
|
.arg("multiline.txt")
|
||||||
|
.arg("--line-range=:2")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("line 1\nline 2\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn line_range_last_3() {
|
||||||
|
bat()
|
||||||
|
.arg("multiline.txt")
|
||||||
|
.arg("--line-range=2:")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("line 2\nline 3\nline 4\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fail_non_existing() {
|
||||||
|
bat().arg("non-existing-file").assert().failure();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn fail_directory() {
|
||||||
|
bat().arg("sub_directory").assert().failure();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn do_not_exit_directory() {
|
||||||
|
bat()
|
||||||
|
.arg("sub_directory")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.stdout("hello world\n")
|
||||||
|
.failure();
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pager_basic() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "echo pager-output")
|
||||||
|
.arg("--paging=always")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("pager-output\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pager_overwrite() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "echo other-pager")
|
||||||
|
.env("BAT_PAGER", "echo pager-output")
|
||||||
|
.arg("--paging=always")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("pager-output\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn pager_disable() {
|
||||||
|
bat()
|
||||||
|
.env("PAGER", "echo other-pager")
|
||||||
|
.env("BAT_PAGER", "")
|
||||||
|
.arg("--paging=always")
|
||||||
|
.arg("test.txt")
|
||||||
|
.assert()
|
||||||
|
.success()
|
||||||
|
.stdout("hello world\n");
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
mod tester;
|
||||||
|
|
||||||
|
use tester::BatTester;
|
||||||
|
|
||||||
|
macro_rules! snapshot_tests {
|
||||||
|
($($test_name: ident: $style: expr => [wrap: $wrap:expr, tabs: $tabs:expr],)*) => {
|
||||||
|
$(
|
||||||
|
#[test]
|
||||||
|
fn $test_name() {
|
||||||
|
let bat_tester = BatTester::new();
|
||||||
|
bat_tester.test_snapshot(stringify!($test_name), $style, $tabs, $wrap);
|
||||||
|
}
|
||||||
|
)*
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
snapshot_tests! {
|
||||||
|
changes: "changes" => [wrap: false, tabs: 8],
|
||||||
|
grid: "grid" => [wrap: false, tabs: 8],
|
||||||
|
header: "header" => [wrap: false, tabs: 8],
|
||||||
|
numbers: "numbers" => [wrap: false, tabs: 8],
|
||||||
|
changes_grid: "changes,grid" => [wrap: false, tabs: 8],
|
||||||
|
changes_header: "changes,header" => [wrap: false, tabs: 8],
|
||||||
|
changes_numbers: "changes,numbers" => [wrap: false, tabs: 8],
|
||||||
|
grid_header: "grid,header" => [wrap: false, tabs: 8],
|
||||||
|
grid_numbers: "grid,numbers" => [wrap: false, tabs: 8],
|
||||||
|
header_numbers: "header,numbers" => [wrap: false, tabs: 8],
|
||||||
|
changes_grid_header: "changes,grid,header" => [wrap: false, tabs: 8],
|
||||||
|
changes_grid_numbers: "changes,grid,numbers" => [wrap: false, tabs: 8],
|
||||||
|
changes_header_numbers: "changes,header,numbers" => [wrap: false, tabs: 8],
|
||||||
|
grid_header_numbers: "grid,header,numbers" => [wrap: false, tabs: 8],
|
||||||
|
changes_grid_header_numbers: "changes,grid,header,numbers" => [wrap: false, tabs: 8],
|
||||||
|
full: "full" => [wrap: false, tabs: 8],
|
||||||
|
plain: "plain" => [wrap: false, tabs: 0],
|
||||||
|
tabs_passthrough_wrapped: "full" => [wrap: true, tabs: 0],
|
||||||
|
tabs_4_wrapped: "full" => [wrap: true, tabs: 4],
|
||||||
|
tabs_8_wrapped: "full" => [wrap: true, tabs: 8],
|
||||||
|
tabs_passthrough: "full" => [wrap: false, tabs: 0],
|
||||||
|
tabs_4: "full" => [wrap: false, tabs: 4],
|
||||||
|
tabs_8: "full" => [wrap: false, tabs: 8],
|
||||||
|
}
|
||||||
@@ -1,43 +1,64 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import itertools
|
import itertools
|
||||||
import subprocess
|
import subprocess
|
||||||
import pathlib
|
import pathlib
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
|
||||||
def generate_snapshots():
|
def generate_snapshots():
|
||||||
single_styles = ["changes", "grid", "header", "numbers"]
|
single_styles = ["changes", "grid", "header", "numbers"]
|
||||||
collective_styles = ["full", "plain"]
|
collective_styles = ["full", "plain"]
|
||||||
|
|
||||||
for num in range(len(single_styles)):
|
for num in range(len(single_styles)):
|
||||||
for grouped in itertools.combinations(single_styles, num + 1):
|
for grouped in itertools.combinations(single_styles, num + 1):
|
||||||
generate_snapshot(",".join(grouped))
|
generate_style_snapshot(",".join(grouped))
|
||||||
|
|
||||||
for style in collective_styles:
|
for style in collective_styles:
|
||||||
generate_snapshot(style)
|
generate_style_snapshot(style)
|
||||||
|
|
||||||
def generate_snapshot(option):
|
generate_snapshot("tabs_passthrough", "--tabs=0 --style=full --wrap=never")
|
||||||
command = "../../target/debug/bat --style={0} sample.rs > output/{0}.snapshot.txt".format(
|
generate_snapshot("tabs_passthrough_wrapped", "--tabs=0 --style=full --wrap=character")
|
||||||
option
|
generate_snapshot("tabs_4", "--tabs=4 --style=full --wrap=never")
|
||||||
|
generate_snapshot("tabs_4_wrapped", "--tabs=4 --style=full --wrap=character")
|
||||||
|
generate_snapshot("tabs_8", "--tabs=8 --style=full --wrap=never")
|
||||||
|
generate_snapshot("tabs_8_wrapped", "--tabs=8 --style=full --wrap=character")
|
||||||
|
|
||||||
|
|
||||||
|
def generate_style_snapshot(style):
|
||||||
|
generate_snapshot(style.replace(",", "_"), "--style={}".format(style))
|
||||||
|
|
||||||
|
|
||||||
|
def generate_snapshot(name, arguments):
|
||||||
|
command = "cargo run -- --paging=never --color=never --decorations=always "
|
||||||
|
command += "{args} sample.rs > output/{name}.snapshot.txt".format(
|
||||||
|
name=name,
|
||||||
|
args=arguments
|
||||||
)
|
)
|
||||||
print("generating snapshot for {}".format(option))
|
print("generating snapshot for {}".format(name))
|
||||||
subprocess.call(command, shell=True)
|
subprocess.call(command, shell=True)
|
||||||
|
|
||||||
|
|
||||||
def build_bat():
|
def build_bat():
|
||||||
print("building bat")
|
print("building bat")
|
||||||
subprocess.call("cargo build", cwd="../..", shell=True)
|
subprocess.call("cargo build", cwd="../..", shell=True)
|
||||||
|
|
||||||
|
|
||||||
def prepare_output_dir():
|
def prepare_output_dir():
|
||||||
shutil.rmtree("output", ignore_errors=True)
|
shutil.rmtree("output", ignore_errors=True)
|
||||||
pathlib.Path("output").mkdir()
|
pathlib.Path("output").mkdir()
|
||||||
|
|
||||||
|
|
||||||
def modify_sample_file():
|
def modify_sample_file():
|
||||||
print("modifying sample.rs to show changes")
|
print("modifying sample.rs to show changes")
|
||||||
shutil.copyfile("sample.modified.rs", "sample.rs")
|
shutil.copyfile("sample.modified.rs", "sample.rs")
|
||||||
|
|
||||||
|
|
||||||
def undo_sample_file_modification():
|
def undo_sample_file_modification():
|
||||||
print("undoing sample.rs modifications")
|
print("undoing sample.rs modifications")
|
||||||
subprocess.call("git checkout -- sample.rs", shell=True)
|
subprocess.call("git checkout -- sample.rs", shell=True)
|
||||||
|
|
||||||
|
|
||||||
build_bat()
|
build_bat()
|
||||||
prepare_output_dir()
|
prepare_output_dir()
|
||||||
modify_sample_file()
|
modify_sample_file()
|
||||||
|
|||||||
@@ -16,7 +16,21 @@ _ fn main() {
|
|||||||
fn area(rectangle: &Rectangle) -> u32 {
|
fn area(rectangle: &Rectangle) -> u32 {
|
||||||
rectangle.width * rectangle.height
|
rectangle.width * rectangle.height
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ fn perimeter(rectangle: &Rectangle) -> u32 {
|
+ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
+ (rectangle.width + rectangle.height) * 2
|
+ (rectangle.width + rectangle.height) * 2
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
~ */
|
||||||
|
|||||||
+15
-1
@@ -16,8 +16,22 @@ _ │ fn main() {
|
|||||||
│ fn area(rectangle: &Rectangle) -> u32 {
|
│ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
│ rectangle.width * rectangle.height
|
│ rectangle.width * rectangle.height
|
||||||
│ }
|
│ }
|
||||||
+ │
|
│
|
||||||
+ │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
+ │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
+ │ (rectangle.width + rectangle.height) * 2
|
+ │ (rectangle.width + rectangle.height) * 2
|
||||||
+ │ }
|
+ │ }
|
||||||
|
+ │
|
||||||
|
│ // Tab alignment:
|
||||||
|
│ /*
|
||||||
|
│ Indent
|
||||||
|
│ 1 2 3 4
|
||||||
|
│ 1 ?
|
||||||
|
│ 22 ?
|
||||||
|
│ 333 ?
|
||||||
|
│ 4444 ?
|
||||||
|
│ 55555 ?
|
||||||
|
│ 666666 ?
|
||||||
|
│ 7777777 ?
|
||||||
|
│ 88888888 ?
|
||||||
|
~ │ */
|
||||||
──┴─────────────────────────────────────────────────────────────────────────────
|
──┴─────────────────────────────────────────────────────────────────────────────
|
||||||
+15
-1
@@ -19,8 +19,22 @@ _ │ fn main() {
|
|||||||
│ fn area(rectangle: &Rectangle) -> u32 {
|
│ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
│ rectangle.width * rectangle.height
|
│ rectangle.width * rectangle.height
|
||||||
│ }
|
│ }
|
||||||
+ │
|
│
|
||||||
+ │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
+ │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
+ │ (rectangle.width + rectangle.height) * 2
|
+ │ (rectangle.width + rectangle.height) * 2
|
||||||
+ │ }
|
+ │ }
|
||||||
|
+ │
|
||||||
|
│ // Tab alignment:
|
||||||
|
│ /*
|
||||||
|
│ Indent
|
||||||
|
│ 1 2 3 4
|
||||||
|
│ 1 ?
|
||||||
|
│ 22 ?
|
||||||
|
│ 333 ?
|
||||||
|
│ 4444 ?
|
||||||
|
│ 55555 ?
|
||||||
|
│ 666666 ?
|
||||||
|
│ 7777777 ?
|
||||||
|
│ 88888888 ?
|
||||||
|
~ │ */
|
||||||
──┴─────────────────────────────────────────────────────────────────────────────
|
──┴─────────────────────────────────────────────────────────────────────────────
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
───────┬────────────────────────────────────────────────────────────────────────
|
||||||
|
│ File: sample.rs
|
||||||
|
───────┼────────────────────────────────────────────────────────────────────────
|
||||||
|
1 │ struct Rectangle {
|
||||||
|
2 │ width: u32,
|
||||||
|
3 │ height: u32,
|
||||||
|
4 │ }
|
||||||
|
5 │
|
||||||
|
6 _ │ fn main() {
|
||||||
|
7 │ let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
8 │
|
||||||
|
9 │ println!(
|
||||||
|
10 ~ │ "The perimeter of the rectangle is {} pixels.",
|
||||||
|
11 ~ │ perimeter(&rect1)
|
||||||
|
12 │ );
|
||||||
|
13 + │ println!(r#"This line contains invalid utf8: "�����"#;
|
||||||
|
14 │ }
|
||||||
|
15 │
|
||||||
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
|
17 │ rectangle.width * rectangle.height
|
||||||
|
18 │ }
|
||||||
|
19 │
|
||||||
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
+15
-1
@@ -16,8 +16,22 @@
|
|||||||
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
17 │ rectangle.width * rectangle.height
|
17 │ rectangle.width * rectangle.height
|
||||||
18 │ }
|
18 │ }
|
||||||
19 + │
|
19 │
|
||||||
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 + │ (rectangle.width + rectangle.height) * 2
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
22 + │ }
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
───────┴────────────────────────────────────────────────────────────────────────
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
+15
-1
@@ -17,7 +17,21 @@ _ fn main() {
|
|||||||
fn area(rectangle: &Rectangle) -> u32 {
|
fn area(rectangle: &Rectangle) -> u32 {
|
||||||
rectangle.width * rectangle.height
|
rectangle.width * rectangle.height
|
||||||
}
|
}
|
||||||
+
|
|
||||||
+ fn perimeter(rectangle: &Rectangle) -> u32 {
|
+ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
+ (rectangle.width + rectangle.height) * 2
|
+ (rectangle.width + rectangle.height) * 2
|
||||||
+ }
|
+ }
|
||||||
|
+
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
~ */
|
||||||
+15
-1
@@ -17,7 +17,21 @@
|
|||||||
16 fn area(rectangle: &Rectangle) -> u32 {
|
16 fn area(rectangle: &Rectangle) -> u32 {
|
||||||
17 rectangle.width * rectangle.height
|
17 rectangle.width * rectangle.height
|
||||||
18 }
|
18 }
|
||||||
19 +
|
19
|
||||||
20 + fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 + fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 + (rectangle.width + rectangle.height) * 2
|
21 + (rectangle.width + rectangle.height) * 2
|
||||||
22 + }
|
22 + }
|
||||||
|
23 +
|
||||||
|
24 // Tab alignment:
|
||||||
|
25 /*
|
||||||
|
26 Indent
|
||||||
|
27 1 2 3 4
|
||||||
|
28 1 ?
|
||||||
|
29 22 ?
|
||||||
|
30 333 ?
|
||||||
|
31 4444 ?
|
||||||
|
32 55555 ?
|
||||||
|
33 666666 ?
|
||||||
|
34 7777777 ?
|
||||||
|
35 88888888 ?
|
||||||
|
36 ~ */
|
||||||
+15
-1
@@ -16,7 +16,21 @@
|
|||||||
16 fn area(rectangle: &Rectangle) -> u32 {
|
16 fn area(rectangle: &Rectangle) -> u32 {
|
||||||
17 rectangle.width * rectangle.height
|
17 rectangle.width * rectangle.height
|
||||||
18 }
|
18 }
|
||||||
19 +
|
19
|
||||||
20 + fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 + fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 + (rectangle.width + rectangle.height) * 2
|
21 + (rectangle.width + rectangle.height) * 2
|
||||||
22 + }
|
22 + }
|
||||||
|
23 +
|
||||||
|
24 // Tab alignment:
|
||||||
|
25 /*
|
||||||
|
26 Indent
|
||||||
|
27 1 2 3 4
|
||||||
|
28 1 ?
|
||||||
|
29 22 ?
|
||||||
|
30 333 ?
|
||||||
|
31 4444 ?
|
||||||
|
32 55555 ?
|
||||||
|
33 666666 ?
|
||||||
|
34 7777777 ?
|
||||||
|
35 88888888 ?
|
||||||
|
36 ~ */
|
||||||
@@ -19,8 +19,22 @@
|
|||||||
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
17 │ rectangle.width * rectangle.height
|
17 │ rectangle.width * rectangle.height
|
||||||
18 │ }
|
18 │ }
|
||||||
19 + │
|
19 │
|
||||||
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 + │ (rectangle.width + rectangle.height) * 2
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
22 + │ }
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
───────┴────────────────────────────────────────────────────────────────────────
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
@@ -20,4 +20,18 @@ fn area(rectangle: &Rectangle) -> u32 {
|
|||||||
fn perimeter(rectangle: &Rectangle) -> u32 {
|
fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
(rectangle.width + rectangle.height) * 2
|
(rectangle.width + rectangle.height) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
*/
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
────────────────────────────────────────────────────────────────────────────────
|
||||||
|
|||||||
+14
@@ -23,4 +23,18 @@ fn area(rectangle: &Rectangle) -> u32 {
|
|||||||
fn perimeter(rectangle: &Rectangle) -> u32 {
|
fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
(rectangle.width + rectangle.height) * 2
|
(rectangle.width + rectangle.height) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
*/
|
||||||
────────────────────────────────────────────────────────────────────────────────
|
────────────────────────────────────────────────────────────────────────────────
|
||||||
+14
@@ -23,4 +23,18 @@
|
|||||||
20 │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 │ (rectangle.width + rectangle.height) * 2
|
21 │ (rectangle.width + rectangle.height) * 2
|
||||||
22 │ }
|
22 │ }
|
||||||
|
23 │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 │ */
|
||||||
─────┴──────────────────────────────────────────────────────────────────────────
|
─────┴──────────────────────────────────────────────────────────────────────────
|
||||||
+14
@@ -20,4 +20,18 @@
|
|||||||
20 │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 │ (rectangle.width + rectangle.height) * 2
|
21 │ (rectangle.width + rectangle.height) * 2
|
||||||
22 │ }
|
22 │ }
|
||||||
|
23 │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 │ */
|
||||||
─────┴──────────────────────────────────────────────────────────────────────────
|
─────┴──────────────────────────────────────────────────────────────────────────
|
||||||
@@ -21,3 +21,17 @@ fn area(rectangle: &Rectangle) -> u32 {
|
|||||||
fn perimeter(rectangle: &Rectangle) -> u32 {
|
fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
(rectangle.width + rectangle.height) * 2
|
(rectangle.width + rectangle.height) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
*/
|
||||||
|
|||||||
+14
@@ -21,3 +21,17 @@
|
|||||||
20 fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 (rectangle.width + rectangle.height) * 2
|
21 (rectangle.width + rectangle.height) * 2
|
||||||
22 }
|
22 }
|
||||||
|
23
|
||||||
|
24 // Tab alignment:
|
||||||
|
25 /*
|
||||||
|
26 Indent
|
||||||
|
27 1 2 3 4
|
||||||
|
28 1 ?
|
||||||
|
29 22 ?
|
||||||
|
30 333 ?
|
||||||
|
31 4444 ?
|
||||||
|
32 55555 ?
|
||||||
|
33 666666 ?
|
||||||
|
34 7777777 ?
|
||||||
|
35 88888888 ?
|
||||||
|
36 */
|
||||||
@@ -20,3 +20,17 @@
|
|||||||
20 fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 (rectangle.width + rectangle.height) * 2
|
21 (rectangle.width + rectangle.height) * 2
|
||||||
22 }
|
22 }
|
||||||
|
23
|
||||||
|
24 // Tab alignment:
|
||||||
|
25 /*
|
||||||
|
26 Indent
|
||||||
|
27 1 2 3 4
|
||||||
|
28 1 ?
|
||||||
|
29 22 ?
|
||||||
|
30 333 ?
|
||||||
|
31 4444 ?
|
||||||
|
32 55555 ?
|
||||||
|
33 666666 ?
|
||||||
|
34 7777777 ?
|
||||||
|
35 88888888 ?
|
||||||
|
36 */
|
||||||
|
|||||||
@@ -20,3 +20,17 @@ fn area(rectangle: &Rectangle) -> u32 {
|
|||||||
fn perimeter(rectangle: &Rectangle) -> u32 {
|
fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
(rectangle.width + rectangle.height) * 2
|
(rectangle.width + rectangle.height) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
───────┬────────────────────────────────────────────────────────────────────────
|
||||||
|
│ File: sample.rs
|
||||||
|
───────┼────────────────────────────────────────────────────────────────────────
|
||||||
|
1 │ struct Rectangle {
|
||||||
|
2 │ width: u32,
|
||||||
|
3 │ height: u32,
|
||||||
|
4 │ }
|
||||||
|
5 │
|
||||||
|
6 _ │ fn main() {
|
||||||
|
7 │ let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
8 │
|
||||||
|
9 │ println!(
|
||||||
|
10 ~ │ "The perimeter of the rectangle is {} pixels.",
|
||||||
|
11 ~ │ perimeter(&rect1)
|
||||||
|
12 │ );
|
||||||
|
13 + │ println!(r#"This line contains invalid utf8: "�����"#;
|
||||||
|
14 │ }
|
||||||
|
15 │
|
||||||
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
|
17 │ rectangle.width * rectangle.height
|
||||||
|
18 │ }
|
||||||
|
19 │
|
||||||
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
───────┬────────────────────────────────────────────────────────────────────────
|
||||||
|
│ File: sample.rs
|
||||||
|
───────┼────────────────────────────────────────────────────────────────────────
|
||||||
|
1 │ struct Rectangle {
|
||||||
|
2 │ width: u32,
|
||||||
|
3 │ height: u32,
|
||||||
|
4 │ }
|
||||||
|
5 │
|
||||||
|
6 _ │ fn main() {
|
||||||
|
7 │ let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
8 │
|
||||||
|
9 │ println!(
|
||||||
|
10 ~ │ "The perimeter of the rectangle is {} pixels.",
|
||||||
|
11 ~ │ perimeter(&rect1)
|
||||||
|
12 │ );
|
||||||
|
13 + │ println!(r#"This line contains invalid utf8: "�����"#;
|
||||||
|
14 │ }
|
||||||
|
15 │
|
||||||
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
|
17 │ rectangle.width * rectangle.height
|
||||||
|
18 │ }
|
||||||
|
19 │
|
||||||
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
───────┬────────────────────────────────────────────────────────────────────────
|
||||||
|
│ File: sample.rs
|
||||||
|
───────┼────────────────────────────────────────────────────────────────────────
|
||||||
|
1 │ struct Rectangle {
|
||||||
|
2 │ width: u32,
|
||||||
|
3 │ height: u32,
|
||||||
|
4 │ }
|
||||||
|
5 │
|
||||||
|
6 _ │ fn main() {
|
||||||
|
7 │ let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
8 │
|
||||||
|
9 │ println!(
|
||||||
|
10 ~ │ "The perimeter of the rectangle is {} pixels.",
|
||||||
|
11 ~ │ perimeter(&rect1)
|
||||||
|
12 │ );
|
||||||
|
13 + │ println!(r#"This line contains invalid utf8: "�����"#;
|
||||||
|
14 │ }
|
||||||
|
15 │
|
||||||
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
|
17 │ rectangle.width * rectangle.height
|
||||||
|
18 │ }
|
||||||
|
19 │
|
||||||
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
───────┬────────────────────────────────────────────────────────────────────────
|
||||||
|
│ File: sample.rs
|
||||||
|
───────┼────────────────────────────────────────────────────────────────────────
|
||||||
|
1 │ struct Rectangle {
|
||||||
|
2 │ width: u32,
|
||||||
|
3 │ height: u32,
|
||||||
|
4 │ }
|
||||||
|
5 │
|
||||||
|
6 _ │ fn main() {
|
||||||
|
7 │ let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
8 │
|
||||||
|
9 │ println!(
|
||||||
|
10 ~ │ "The perimeter of the rectangle is {} pixels.",
|
||||||
|
11 ~ │ perimeter(&rect1)
|
||||||
|
12 │ );
|
||||||
|
13 + │ println!(r#"This line contains invalid utf8: "�����"#;
|
||||||
|
14 │ }
|
||||||
|
15 │
|
||||||
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
|
17 │ rectangle.width * rectangle.height
|
||||||
|
18 │ }
|
||||||
|
19 │
|
||||||
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
+15
-1
@@ -19,8 +19,22 @@
|
|||||||
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
17 │ rectangle.width * rectangle.height
|
17 │ rectangle.width * rectangle.height
|
||||||
18 │ }
|
18 │ }
|
||||||
19 + │
|
19 │
|
||||||
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
21 + │ (rectangle.width + rectangle.height) * 2
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
22 + │ }
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
───────┴────────────────────────────────────────────────────────────────────────
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
───────┬────────────────────────────────────────────────────────────────────────
|
||||||
|
│ File: sample.rs
|
||||||
|
───────┼────────────────────────────────────────────────────────────────────────
|
||||||
|
1 │ struct Rectangle {
|
||||||
|
2 │ width: u32,
|
||||||
|
3 │ height: u32,
|
||||||
|
4 │ }
|
||||||
|
5 │
|
||||||
|
6 _ │ fn main() {
|
||||||
|
7 │ let rect1 = Rectangle { width: 30, height: 50 };
|
||||||
|
8 │
|
||||||
|
9 │ println!(
|
||||||
|
10 ~ │ "The perimeter of the rectangle is {} pixels.",
|
||||||
|
11 ~ │ perimeter(&rect1)
|
||||||
|
12 │ );
|
||||||
|
13 + │ println!(r#"This line contains invalid utf8: "�����"#;
|
||||||
|
14 │ }
|
||||||
|
15 │
|
||||||
|
16 │ fn area(rectangle: &Rectangle) -> u32 {
|
||||||
|
17 │ rectangle.width * rectangle.height
|
||||||
|
18 │ }
|
||||||
|
19 │
|
||||||
|
20 + │ fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
|
21 + │ (rectangle.width + rectangle.height) * 2
|
||||||
|
22 + │ }
|
||||||
|
23 + │
|
||||||
|
24 │ // Tab alignment:
|
||||||
|
25 │ /*
|
||||||
|
26 │ Indent
|
||||||
|
27 │ 1 2 3 4
|
||||||
|
28 │ 1 ?
|
||||||
|
29 │ 22 ?
|
||||||
|
30 │ 333 ?
|
||||||
|
31 │ 4444 ?
|
||||||
|
32 │ 55555 ?
|
||||||
|
33 │ 666666 ?
|
||||||
|
34 │ 7777777 ?
|
||||||
|
35 │ 88888888 ?
|
||||||
|
36 ~ │ */
|
||||||
|
───────┴────────────────────────────────────────────────────────────────────────
|
||||||
@@ -20,3 +20,17 @@ fn area(rectangle: &Rectangle) -> u32 {
|
|||||||
fn perimeter(rectangle: &Rectangle) -> u32 {
|
fn perimeter(rectangle: &Rectangle) -> u32 {
|
||||||
(rectangle.width + rectangle.height) * 2
|
(rectangle.width + rectangle.height) * 2
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
*/
|
||||||
|
|||||||
@@ -16,3 +16,17 @@ fn main() {
|
|||||||
fn area(rectangle: &Rectangle) -> u32 {
|
fn area(rectangle: &Rectangle) -> u32 {
|
||||||
rectangle.width * rectangle.height
|
rectangle.width * rectangle.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tab alignment:
|
||||||
|
/*
|
||||||
|
Indent
|
||||||
|
1 2 3 4
|
||||||
|
1 ?
|
||||||
|
22 ?
|
||||||
|
333 ?
|
||||||
|
4444 ?
|
||||||
|
55555 ?
|
||||||
|
666666 ?
|
||||||
|
7777777 ?
|
||||||
|
88888888 ?
|
||||||
|
*/
|
||||||
+10
-3
@@ -38,14 +38,21 @@ impl BatTester {
|
|||||||
BatTester { temp_dir, exe }
|
BatTester { temp_dir, exe }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn test_snapshot(&self, style: &str) {
|
pub fn test_snapshot(&self, name: &str, style: &str, tab_width: u32, wrap: bool) {
|
||||||
let output = Command::new(&self.exe)
|
let output = Command::new(&self.exe)
|
||||||
.current_dir(self.temp_dir.path())
|
.current_dir(self.temp_dir.path())
|
||||||
.args(&[
|
.args(&[
|
||||||
"sample.rs",
|
"sample.rs",
|
||||||
|
"--no-config",
|
||||||
|
"--paging=never",
|
||||||
|
"--color=never",
|
||||||
"--decorations=always",
|
"--decorations=always",
|
||||||
|
"--terminal-width=80",
|
||||||
|
&format!("--wrap={}", if wrap { "character" } else { "never" }),
|
||||||
|
&format!("--tabs={}", tab_width),
|
||||||
&format!("--style={}", style),
|
&format!("--style={}", style),
|
||||||
]).output()
|
])
|
||||||
|
.output()
|
||||||
.expect("bat failed");
|
.expect("bat failed");
|
||||||
|
|
||||||
// have to do the replace because the filename in the header changes based on the current working directory
|
// have to do the replace because the filename in the header changes based on the current working directory
|
||||||
@@ -54,7 +61,7 @@ impl BatTester {
|
|||||||
.replace("tests/snapshots/", "");
|
.replace("tests/snapshots/", "");
|
||||||
|
|
||||||
let mut expected = String::new();
|
let mut expected = String::new();
|
||||||
let mut file = File::open(format!("tests/snapshots/output/{}.snapshot.txt", style))
|
let mut file = File::open(format!("tests/snapshots/output/{}.snapshot.txt", name))
|
||||||
.expect("snapshot file missing");
|
.expect("snapshot file missing");
|
||||||
file.read_to_string(&mut expected)
|
file.read_to_string(&mut expected)
|
||||||
.expect("could not read snapshot file");
|
.expect("could not read snapshot file");
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
mod tester;
|
|
||||||
|
|
||||||
use tester::BatTester;
|
|
||||||
|
|
||||||
static STYLES: &'static [&'static str] = &[
|
|
||||||
"changes",
|
|
||||||
"grid",
|
|
||||||
"header",
|
|
||||||
"numbers",
|
|
||||||
"changes,grid",
|
|
||||||
"changes,header",
|
|
||||||
"changes,numbers",
|
|
||||||
"grid,header",
|
|
||||||
"grid,numbers",
|
|
||||||
"header,numbers",
|
|
||||||
"changes,grid,header",
|
|
||||||
"changes,grid,numbers",
|
|
||||||
"changes,header,numbers",
|
|
||||||
"grid,header,numbers",
|
|
||||||
"changes,grid,header,numbers",
|
|
||||||
"full",
|
|
||||||
"plain",
|
|
||||||
];
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_snapshots() {
|
|
||||||
let bat_tester = BatTester::new();
|
|
||||||
|
|
||||||
for style in STYLES {
|
|
||||||
println!("testing {}", style);
|
|
||||||
bat_tester.test_snapshot(&*style);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user