1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-03 18:51:44 +00:00

Compare commits

...

133 Commits

Author SHA1 Message Date
David Peter c073d4a118 Add new image 2018-11-11 13:19:34 +01:00
sharkdp e79c5516bf Bump version, update assets 2018-11-11 12:55:38 +01:00
sharkdp 4776c2a575 Update man page 2018-11-11 12:31:28 +01:00
sharkdp f98a96c1ed Update help text 2018-11-11 12:26:39 +01:00
sharkdp 8a3446d219 Update dependencies 2018-11-11 12:17:58 +01:00
David Peter 5d5bf616ca Update README.md 2018-11-11 12:17:15 +01:00
sharkdp b68c038db8 Update link to new issue 2018-11-11 11:08:08 +01:00
dependabot[bot] 1117d2f9cb Bump syntect from 3.0.1 to 3.0.2
Bumps [syntect](https://github.com/trishume/syntect) from 3.0.1 to 3.0.2.
- [Release notes](https://github.com/trishume/syntect/releases)
- [Changelog](https://github.com/trishume/syntect/blob/master/CHANGELOG.md)
- [Commits](https://github.com/trishume/syntect/compare/v3.0.1...v3.0.2)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-11 11:08:08 +01:00
David Peter d0ba5bcb32 Wording 2018-11-11 11:07:55 +01:00
Ricky f8d39d5624 Resolving requested changes 2018-11-11 11:07:55 +01:00
Ricky 9998e2eac6 Initial commit of updated README for config file formatting 2018-11-11 11:07:55 +01:00
sharkdp 7cac07d845 issue #383: Handle cases like PAGER=/usr/bin/bat 2018-11-06 19:53:32 +01:00
Rodrigo Orem 148caa1381 Fix code style 2018-11-06 19:35:41 +01:00
Rodrigo Orem ab27cac0cc Remove args when change from bat to less 2018-11-06 19:35:41 +01:00
Rodrigo Orem 01fcbf2183 Better placement of bat detection 2018-11-06 19:35:41 +01:00
Rodrigo Orem 8a0c30b385 Avoid endless bat executions with PAGER="bat"
From issue #383
2018-11-06 19:35:41 +01:00
Dany Marcoux bc21c4d0e0 Add openSUSE installation instructions 2018-11-06 19:21:33 +01:00
dependabot[bot] 0800562ba2 Bump content_inspector from 0.2.3 to 0.2.4
Bumps [content_inspector](https://github.com/sharkdp/content_inspector) from 0.2.3 to 0.2.4.
- [Release notes](https://github.com/sharkdp/content_inspector/releases)
- [Commits](https://github.com/sharkdp/content_inspector/compare/v0.2.3...v0.2.4)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-05 19:37:58 +01:00
sharkdp 1f9befbcd1 Update SHA1 in TOML submodule 2018-11-05 19:37:23 +01:00
sharkdp a5c779c518 Update path to TOML syntax remote 2018-11-05 19:23:44 +01:00
dependabot[bot] f37f100352 Bump lazy_static from 1.1.0 to 1.2.0
Bumps [lazy_static](https://github.com/rust-lang-nursery/lazy-static.rs) from 1.1.0 to 1.2.0.
- [Release notes](https://github.com/rust-lang-nursery/lazy-static.rs/releases)
- [Commits](https://github.com/rust-lang-nursery/lazy-static.rs/compare/1.1.0...1.2.0)

Signed-off-by: dependabot[bot] <support@dependabot.com>
2018-11-05 07:22:39 +01:00
Nisheet Sinvhal 18d1a3b973 Changed italics to use-italic-text in config
Better placing of italics in help and also added long_help for it
2018-11-04 19:40:05 +01:00
Nisheet Sinvhal dc10246bd2 Linting 2018-11-04 19:40:05 +01:00
Nisheet Sinvhal 44bdae0212 Linting 2018-11-04 19:40:05 +01:00
Nisheet Sinvhal 1ece38a4c4 Changed flag name 2018-11-04 19:40:05 +01:00
Nisheet Sinvhal e90308e1f8 italics enable|disable working 2018-11-04 19:40:05 +01:00
Nisheet Sinvhal d702d6740c Added args 2018-11-04 19:40:05 +01:00
sharkdp c6a526f99c Run 'cargo run' only once 2018-11-04 12:24:56 +01:00
sharkdp 278d841408 Move '--paging' arg to config file. 2018-11-04 11:19:49 +01:00
sharkdp 5f576f1ecf Remove all relevant environment variables during testing 2018-11-04 11:19:49 +01:00
sharkdp 48c6ea6b25 Simplify integration test setup 2018-11-04 11:19:49 +01:00
Ricky 558134f6c8 Changed to unwrap methods, added integration tests 2018-11-04 11:19:49 +01:00
Ricky 1dd57e6d7e Ran rust fmt 2018-11-04 11:19:49 +01:00
Ricky 20ba84d1fa Added in environment variable and the result is a file check in config.rs 2018-11-04 11:19:49 +01:00
sharkdp e81f9b23e6 Fix --show-all for UTF-16 encoding 2018-11-01 22:00:47 +01:00
sharkdp 50dc4a79b0 Display line-feed as instead of 2018-11-01 22:00:47 +01:00
sharkdp 8fa8f44706 Use character if tab-width == 1. 2018-11-01 22:00:47 +01:00
sharkdp ecd862d9ff Feature: Highlight non-printable characters
Adds a new `-A`/`--show-all` option (in analogy to GNU Linux `cat`s option) that
highlights non-printable characters like space, tab or newline.

This works in two steps:
- **Preprocessing**: replace space by `•`, replace tab by `├──┤`, replace
newline by `␤`, etc.
- **Highlighting**: Use a newly written Sublime syntax to highlight
these special symbols.

Note: This feature is not technically a drop-in replacement for GNU `cat`s
`--show-all` but it has the same purpose.
2018-11-01 22:00:47 +01:00
sharkdp cbed338c3a Remove generation code for tabs_ tests 2018-11-01 15:30:58 +01:00
sharkdp 4492d99556 Change default tab width to 4 2018-11-01 15:30:58 +01:00
sharkdp d96ee2261f Remove tab-related text 2018-11-01 15:30:58 +01:00
sharkdp dda27b253b Allow offset values in --terminal-width
Allows the `width` argument to `--terminal-width` to be an offset
instead of an absolute number. Examples:

    --terminal-width=80   # Set output width to 80 characters
    --terminal-width=-2   # Set output width to actual_width - 2

closes #376
2018-10-31 22:21:22 +01:00
sharkdp 78f26d0caf Temporarily disable shipping of shell completions
closes #372
2018-10-31 22:03:05 +01:00
David Peter abcd09f869 Remove commented-out code 2018-10-21 22:52:26 +02:00
Sindre Johansen 41a5ff039b Only use the last argument of {style,plain,number} 2018-10-21 22:52:26 +02:00
Sindre Johansen 155bad3862 Rustfmt 2018-10-21 22:52:26 +02:00
Sindre Johansen 7c98a1c901 When specifying style multiple times the last occurence wins
Closes: #367
2018-10-21 22:52:26 +02:00
David Peter c1246fcd53 Update help text 2018-10-21 22:42:11 +02:00
David Peter 9f401ea122 Update docstring 2018-10-21 22:42:11 +02:00
Park Juhyung 9c782fb692 Fix format error 2018-10-21 22:42:11 +02:00
Park Juhyung 154186a58d Add --pager option 2018-10-21 22:42:11 +02:00
David Peter b22a9f8fe3 Update README.md 2018-10-20 14:56:25 +02:00
David Peter 5219c40ed8 PAGER: Wrapper script is not needed anymore 2018-10-20 14:54:44 +02:00
sharkdp a25ee0e6fd Add sublime-snazzy theme 2018-10-20 11:32:25 +02:00
sharkdp 496e0bc046 Allow for multiple line ranges
See #23
2018-10-20 10:44:13 +02:00
sharkdp 7082fd09f0 Modify TravisCI caching policy 2018-10-19 23:06:25 +02:00
David Peter 857cc215b4 Move link to header line 2018-10-19 22:00:05 +02:00
yobrave 481268f018 Doc: add Chinese readme link
#251
2018-10-19 22:00:05 +02:00
sharkdp f7d9f49503 Remove leftovers from tab-tests 2018-10-19 21:57:35 +02:00
Lawrence Chou 88fcfd76aa cargo fmt 2018-10-19 21:04:46 +02:00
Lawrence Chou 76e34b29ec Avoid empty line in snapshot 2018-10-19 21:04:46 +02:00
Lawrence Chou 01984e1d02 Test 'tabs' with 'numbers' 2018-10-19 21:04:46 +02:00
Lawrence Chou 536390509f remove --wrap for now 2018-10-19 21:04:46 +02:00
Lawrence Chou 58198d0700 rewrite 6 snapshot tests as integration test 2018-10-19 21:04:46 +02:00
Lawrence Chou afc5aacb28 Move tabs_* snapshot tests to integration_tests 2018-10-19 21:04:46 +02:00
sharkdp 30b742e984 --map-syntax takes just one value 2018-10-17 23:27:44 +02:00
sharkdp 671deeef8c Update help text 2018-10-17 23:17:28 +02:00
sharkdp a892caeb33 Bump bat version to 0.8 2018-10-17 23:15:59 +02:00
sharkdp a770cbf25e Update assets 2018-10-17 23:14:07 +02:00
sharkdp 931c6e9414 Update man page 2018-10-17 23:13:50 +02:00
sharkdp 8dc7e2efa3 Add --config-file option 2018-10-17 23:08:37 +02:00
sharkdp 10965a6122 Implement syntax mapping
This adds a `-m`/`--map-syntax` option that allows users to (re)map
certain file extensions or file names to an existing syntax.

For example:
```
bat --map-syntax .config:json
```

The option can be use multiple times. Note that you can easily make
these mappings permanent by using `bat`s new configuration file.

closes #169
2018-10-17 23:08:19 +02:00
sharkdp e43d97dc15 Small cleanup 2018-10-17 21:12:23 +02:00
sharkdp 2c7087b8de Add integration tests for pager handling 2018-10-17 21:08:32 +02:00
sharkdp bb1f5aa841 Add proper handling of empty PAGER variables 2018-10-17 21:08:32 +02:00
sharkdp 2109a7830b Add error handling for parsing errors 2018-10-17 21:08:32 +02:00
sharkdp ec27c78a8a Remove duplicate 'extern crate' 2018-10-17 21:08:32 +02:00
Morten Linderud 67fe833bc8 Add arguments from PAGER/BAT_PAGER
Solves #352

Signed-off-by: Morten Linderud <morten@linderud.pw>
2018-10-17 21:08:32 +02:00
sharkdp e956225b4d Update syntect to 3.0.1
closes #314
2018-10-16 23:06:46 +02:00
sharkdp 314ec881ef Bump Rust version 2018-10-16 22:09:15 +02:00
sharkdp 25a6a55437 Revert "Fix for older version of Rust"
This reverts commit c530fadc44.
2018-10-16 22:09:15 +02:00
sharkdp 5bff4548be Add BAT_OPTS environment variable 2018-10-16 22:09:15 +02:00
sharkdp 866b9e16a8 Add error handling 2018-10-16 22:09:15 +02:00
sharkdp 5af176c94f Move transpose to util module 2018-10-16 22:09:15 +02:00
sharkdp 9e7da05459 Fix for older version of Rust 2018-10-16 22:09:15 +02:00
sharkdp 1ae02c65fb Fix include 2018-10-16 22:09:15 +02:00
sharkdp 495e7fd3b1 Add --no-config option 2018-10-16 22:09:15 +02:00
sharkdp b48f0fe389 Fix tests 2018-10-16 22:09:15 +02:00
sharkdp c19c704a43 Add more tests 2018-10-16 22:09:15 +02:00
sharkdp 693bd5929d Add possibility for spaces on a single line 2018-10-16 22:09:15 +02:00
sharkdp 8275b0436d Add simple configuration file
This allows users to create simple configuration file
(`~/.config/bat/config` on Linux) that has the following format:

    ```bash
    --flag1
    --flag2
    --option1=value1
    # lines beginning with '#' are ignored
    --option2=value2
    # empty lines and trailing whitespace are also ignored

    --option3=value3
    ```
2018-10-16 22:09:15 +02:00
sharkdp 278bde5cee Continue with output after "is directory"-error 2018-10-11 21:54:19 +02:00
Russ Taylor eee7e5a575 Removes duplicate explanation. 2018-10-11 20:58:44 +02:00
Russ Taylor ad7b634ee6 Fixes #328 - adds info for light backgrounds. 2018-10-11 20:58:44 +02:00
David Peter 1310f83c8d Update Docker alias for bat 2018-10-11 20:57:46 +02:00
David Peter 897b9e7030 Add Docker instructions, closes #331 2018-10-11 20:05:17 +02:00
sharkdp 1891e194b5 Add simple integration tests 2018-10-11 07:06:13 +02:00
sharkdp d2d01b9fe8 Always remove the local cache when creating new assets 2018-10-10 21:49:03 +02:00
sharkdp 5842d58c01 Updates for syntect 3.0 2018-10-09 22:04:51 +02:00
Tim Sampson e3c71adba7 syntax: Add robot framework support 2018-10-09 20:27:01 +02:00
Merlin Göttlinger 504f28b3a1 Documented nix availability 2018-10-09 20:07:27 +02:00
Fredrik Fornwall d977ba9194 Update dependencies 2018-10-08 22:33:09 +02:00
Tim Sampson 9c09799e1f misc: add exec bit for create.sh 2018-10-08 20:20:05 +02:00
David Peter d83c93c805 Update README.md 2018-10-07 18:39:52 +02:00
sharkdp fc8fd1e63f cargo fmt 2018-10-07 17:49:38 +02:00
sharkdp 404d6a4a81 Update content_inspector version 2018-10-07 17:49:38 +02:00
sharkdp 25d96da4a2 Add support for UTF-16LE and UTF-16BE 2018-10-07 17:49:38 +02:00
sharkdp e97095b724 Use first-line detection for STDIN 2018-10-07 15:34:37 +02:00
sharkdp ce96df00b6 Do not display binary files in interactive mode
closes #248
2018-10-07 15:34:37 +02:00
sharkdp f98fc5f06a Simplify access to first line 2018-10-07 15:34:37 +02:00
sharkdp 1dbb4ef683 Update minimum Rust version to 1.27 2018-10-07 15:34:37 +02:00
sharkdp 0502a3bd4a Add first-line detection for all input types
closes #205
2018-10-07 15:34:37 +02:00
sharkdp 869cf6368c Add possibility to get first line 2018-10-07 15:34:37 +02:00
sharkdp 078228deac Add unit test for InputFileReader 2018-10-07 15:34:37 +02:00
sharkdp e09d7dabb8 Move snapshot tests into separate module 2018-10-07 15:34:37 +02:00
sharkdp 6d1cc8c2c8 Move read_line functionality to inputfile module 2018-10-07 15:34:37 +02:00
sharkdp 87f021078e Use dyn Trait for trait objects 2018-10-07 15:34:37 +02:00
sharkdp d5b0502419 Move get_reader into inputfile module 2018-10-07 15:34:37 +02:00
sharkdp 860f3e9006 Move InputFile to separate module 2018-10-07 15:34:37 +02:00
sharkdp 1be346a038 Add 'plain' version of bat to the benchmarks 2018-10-07 10:57:08 +02:00
sharkdp f9fd5e4851 Simplify -h help text 2018-10-07 10:43:39 +02:00
sharkdp da09f3877b Remove unnecessary scope 2018-10-07 10:09:10 +02:00
sharkdp e30e1bab2e Move theme-preview section into own paragraph 2018-10-06 21:12:12 +02:00
Russ Taylor f140f6da46 Fixes #273 - describes 'musl' builds. 2018-10-06 21:07:01 +02:00
Grégoire Paris 3446fdf5f2 Document how to rapidly preview theme on a file 2018-10-06 21:06:31 +02:00
sharkdp e1345cdc2a Update VimL syntax 2018-10-05 18:44:51 +02:00
sharkdp a2676ccc55 Workaround for #81 2018-10-04 11:09:41 +02:00
Richard Hozák b39e28d2c8 Add support for wildcards in Windows CMD (#329)
Windows does not support wildcard expansion in cmd, this adds 'wild' crate (as discussed in #309) that handles everything transparently, so wildcards work everywhere.

Fixes #309
2018-10-03 22:59:11 +02:00
davideGiovannini 0d71968615 Generate shell completions with clap during build (#327)
* Generate shell completions with clap during build

* Updated ci release script, added SHELL_COMPLETIONS_DIR override to build.rs and fixed dependency version
2018-10-03 09:39:30 +02:00
sharkdp 80da0dc619 run cargo fmt 2018-09-26 19:16:03 +02:00
sharkdp 64903bb858 Typo 2018-09-26 19:13:32 +02:00
sharkdp 3456ce1187 Add a small tutorial 2018-09-26 18:08:24 +02:00
sharkdp 886a5b3d24 Document the situation with less and scrolling
closes #312
closes #246
2018-09-26 18:03:46 +02:00
73 changed files with 2421 additions and 1306 deletions
+7 -1
View File
@@ -6,7 +6,7 @@
url = https://github.com/sublimehq/Packages/ url = https://github.com/sublimehq/Packages/
[submodule "assets/syntaxes/TOML"] [submodule "assets/syntaxes/TOML"]
path = assets/syntaxes/TOML path = assets/syntaxes/TOML
url = https://github.com/sharkdp/sublime_toml_highlighting url = https://github.com/jasonwilliams/sublime_toml_highlighting
[submodule "assets/syntaxes/Julia"] [submodule "assets/syntaxes/Julia"]
path = assets/syntaxes/Julia path = assets/syntaxes/Julia
url = https://github.com/JuliaEditorSupport/Julia-sublime url = https://github.com/JuliaEditorSupport/Julia-sublime
@@ -91,3 +91,9 @@
[submodule "assets/syntaxes/PowerShell"] [submodule "assets/syntaxes/PowerShell"]
path = assets/syntaxes/PowerShell path = assets/syntaxes/PowerShell
url = https://github.com/PowerShell/EditorSyntax url = https://github.com/PowerShell/EditorSyntax
[submodule "assets/syntaxes/Robot"]
path = assets/syntaxes/Robot
url = https://github.com/andriyko/sublime-robot-framework-assistant.git
[submodule "assets/themes/sublime-snazzy"]
path = assets/themes/sublime-snazzy
url = https://github.com/greggb/sublime-snazzy
+12 -5
View File
@@ -1,5 +1,5 @@
language: rust language: rust
cache: cargo
matrix: matrix:
include: include:
# Stable channel. # Stable channel.
@@ -29,18 +29,18 @@ matrix:
- TARGET=aarch64-unknown-linux-gnu - TARGET=aarch64-unknown-linux-gnu
- CC_aarch64-unknown-linux-gnu=/usr/bin/aarch64-linux-gnu-gcc-4.8 - 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 - 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
@@ -103,3 +103,10 @@ deploy:
notifications: notifications:
email: email:
on_success: never on_success: never
# Caching
cache:
directories:
- /home/travis/.cargo
before_cache:
- rm -rf /home/travis/.cargo/registry
Generated
+355 -157
View File
@@ -1,9 +1,14 @@
[[package]]
name = "adler32"
version = "1.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "aho-corasick" name = "aho-corasick"
version = "0.6.8" version = "0.6.9"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -22,6 +27,17 @@ dependencies = [
"winapi 0.3.6 (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]]
name = "atty" name = "atty"
version = "0.2.11" version = "0.2.11"
@@ -34,28 +50,34 @@ dependencies = [
[[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.7 (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.7.1" version = "0.9.0"
dependencies = [ dependencies = [
"ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)", "ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"ansi_term 0.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.2 (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.4 (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)",
"escargot 0.3.1 (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.2.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.2 (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]]
@@ -63,8 +85,8 @@ name = "bincode"
version = "1.0.1" 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.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -72,9 +94,14 @@ name = "bitflags"
version = "1.0.4" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "build_const"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "byteorder" name = "byteorder"
version = "1.2.6" version = "1.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@@ -84,19 +111,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "cfg-if" name = "cfg-if"
version = "0.1.5" version = "0.1.6"
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.6 (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"
@@ -109,6 +126,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]]
@@ -137,36 +155,124 @@ 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)", "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 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.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.4 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)", "regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
"termios 0.3.0 (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.6 (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.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "crc"
version = "1.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"build_const 0.2.1 (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.6 (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.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "flate2" name = "flate2"
version = "1.0.2" version = "1.0.4"
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)",
"miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -195,9 +301,22 @@ 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.9 (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.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (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.2 (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]]
@@ -231,11 +350,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "lazy_static" name = "lazy_static"
version = "1.1.0" version = "1.2.0"
source = "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" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"version_check 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "libc" name = "libc"
@@ -244,18 +365,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libgit2-sys" name = "libgit2-sys"
version = "0.7.9" 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.25 (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)",
"libz-sys 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.25 (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.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"
dependencies = [ dependencies = [
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -271,7 +392,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)",
@@ -280,10 +401,10 @@ dependencies = [
[[package]] [[package]]
name = "log" name = "log"
version = "0.4.5" version = "0.4.6"
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.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -293,17 +414,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "memchr" name = "memchr"
version = "2.1.0" version = "2.1.1"
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.6 (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.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]] [[package]]
name = "miniz-sys" name = "miniz-sys"
version = "0.1.10" version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -311,32 +432,38 @@ dependencies = [
] ]
[[package]] [[package]]
name = "num-integer" name = "miniz_oxide"
version = "0.1.39" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "num-traits" name = "miniz_oxide_c_api"
version = "0.2.6" version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
"crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
"miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "onig" name = "onig"
version = "3.2.2" version = "4.2.1"
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.2.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.1 (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.1" 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.25 (registry+https://github.com/rust-lang/crates.io-index)", "cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -357,7 +484,7 @@ name = "parking_lot"
version = "0.6.4" 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.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@@ -385,30 +512,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.7 (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.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (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.19" version = "0.4.21"
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.10"
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.19 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.21 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -429,13 +584,21 @@ dependencies = [
"cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)", "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)", "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)",
"rand_core 0.2.1 (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)", "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "rand_core" name = "rand_core"
version = "0.2.1" 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" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@@ -453,27 +616,22 @@ dependencies = [
[[package]] [[package]]
name = "regex" name = "regex"
version = "1.0.5" version = "1.0.6"
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.9 (registry+https://github.com/rust-lang/crates.io-index)",
"memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.3 (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.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "regex-syntax" name = "regex-syntax"
version = "0.4.2" version = "0.6.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "regex-syntax"
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 = [
"ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", "ucd-util 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
@@ -494,17 +652,17 @@ dependencies = [
[[package]] [[package]]
name = "ryu" name = "ryu"
version = "0.2.6" version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index" 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]]
name = "same-file" name = "same-file"
version = "1.0.3" version = "1.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"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)",
@@ -530,29 +688,37 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.79" version = "1.0.80"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.79" version = "1.0.80"
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.19 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.21 (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.10 (registry+https://github.com/rust-lang/crates.io-index)",
"syn 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)", "syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "serde_json" name = "serde_json"
version = "1.0.28" version = "1.0.33"
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.3 (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.7 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (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"
@@ -573,31 +739,32 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "syn" name = "syn"
version = "0.15.5" version = "0.15.19"
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.19 (registry+https://github.com/rust-lang/crates.io-index)", "proc-macro2 0.4.21 (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.10 (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.2"
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.4 (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.2.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.1 (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.79 (registry+https://github.com/rust-lang/crates.io-index)", "regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)", "serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)", "serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.5 (registry+https://github.com/rust-lang/crates.io-index)", "serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)",
"walkdir 2.2.6 (registry+https://github.com/rust-lang/crates.io-index)",
"yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", "yaml-rust 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
@@ -632,7 +799,7 @@ dependencies = [
[[package]] [[package]]
name = "termios" name = "termios"
version = "0.3.0" 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)",
@@ -652,22 +819,17 @@ name = "thread_local"
version = "0.3.6" 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 = [
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[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.6 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "ucd-util" name = "ucd-util"
version = "0.1.1" version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
@@ -703,7 +865,7 @@ dependencies = [
[[package]] [[package]]
name = "url" name = "url"
version = "1.7.1" version = "1.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -713,7 +875,7 @@ dependencies = [
[[package]] [[package]]
name = "utf8-ranges" name = "utf8-ranges"
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"
[[package]] [[package]]
@@ -721,9 +883,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]]
@@ -733,14 +900,22 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "walkdir" name = "walkdir"
version = "2.2.5" version = "2.2.6"
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.4 (registry+https://github.com/rust-lang/crates.io-index)",
"winapi 0.3.6 (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"
@@ -795,97 +970,120 @@ dependencies = [
] ]
[metadata] [metadata]
"checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a" "checksum adler32 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "7e522997b529f05601e05166c07ed17789691f562762c7f3b987263d2dedee5c"
"checksum aho-corasick 0.6.9 (registry+https://github.com/rust-lang/crates.io-index)" = "1e9a933f4e58658d7b12defcf96dc5c720f20832deebe3e0a19efd3b6aaeeb9e"
"checksum ansi_colours 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0f302a81afc6a7f4350c04f0ba7cfab529cc009bca3324b3fb5764e6add8b6" "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 build_const 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "39092a32794787acd8525ee150305ff051b0aa6cc2abaf193924f5ab05425f39"
"checksum byteorder 1.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "94f88df23a25417badc922ab0f5716cc1330e87f71ddd9203b3a3ccd9cedf75d"
"checksum cc 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "f159dfd43363c4d08055a07703eb7a3406b0dac4d0584d96965a3262db3c9d16" "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.6 (registry+https://github.com/rust-lang/crates.io-index)" = "082bb9b28e00d3c9d39cc03e64ce4cea0f1bb9b3fde493f0cbc008472d22bdf4"
"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 cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" "checksum cloudabi 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
"checksum console 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ecd48adf136733979b49e15bc3b4c43cc0d3c85ece7bd08e6daa414c6fcb13e6" "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.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b7bda66e858c683005a53a9a60c69a4aca7eeaa45d124526e389f7aec8e62f38"
"checksum crc 1.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d663548de7f5cca343f1e0a48d14dcfb0e9eb4e079ec58883b7251539fa10aeb"
"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.4 (registry+https://github.com/rust-lang/crates.io-index)" = "3b0c7353385f92079524de3b7116cf99d73947c08a7472774e9b3b04bff3b901"
"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.3 (registry+https://github.com/rust-lang/crates.io-index)" = "1306f3464951f30e30d12373d31c79fbd52d236e5e896fd92f96ec7babbbe60b" "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.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
"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.9 (registry+https://github.com/rust-lang/crates.io-index)" = "93f2b22fce91fb820363cf88a849a8f8fdfd8be37774b6a9dd6cbda05cf940e6" "checksum libgit2-sys 0.7.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4916b5addc78ec36cc309acfcdf0b9f9d97ab7b84083118b248709c5b7029356"
"checksum libz-sys 1.0.22 (registry+https://github.com/rust-lang/crates.io-index)" = "65ff614643d7635dfa2151913d95c4ee90ee1fe15d9e0980f4dcb1a7e5837c18" "checksum libz-sys 1.0.25 (registry+https://github.com/rust-lang/crates.io-index)" = "2eb5e43362e38e2bca2fd5f5134c4d4564a23a5c28e9b95411652021a8675ebe"
"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.5 (registry+https://github.com/rust-lang/crates.io-index)" = "d4fcce5fa49cc693c312001daf1d13411c4a5283796bac1084299ea3e567113f" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6"
"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.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "4b3629fe9fdbff6daa6c33b90f7c08355c1aca05a3d01fa8063b822fcf185f3b" "checksum memchr 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0a3eb002f0535929f1199681417029ebea04aadc0c7a4224b46be99c7f5d6a16"
"checksum miniz-sys 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "609ce024854aeb19a0ef7567d348aaa5a746b32fb72e336df7fcc16869d7e2b4" "checksum miniz-sys 0.1.11 (registry+https://github.com/rust-lang/crates.io-index)" = "0300eafb20369952951699b68243ab4334f4b10a88f411c221d444b36c40e649"
"checksum num-integer 0.1.39 (registry+https://github.com/rust-lang/crates.io-index)" = "e83d528d2677f0518c570baf2b7abdcf0cd2d248860b68507bdcb3e91d4c0cea" "checksum miniz_oxide 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5ad30a47319c16cde58d0314f5d98202a80c9083b5f61178457403dfb14e509c"
"checksum num-traits 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0b3a5d7cc97d6d30d8b9bc8fa19bf45349ffe46241e8816f50f62f6d6aaabee1" "checksum miniz_oxide_c_api 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "28edaef377517fd9fe3e085c37d892ce7acd1fbeab9239c5a36eec352d8a8b7e"
"checksum onig 3.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f5eeb268a4620c74ea5768c6d2ccd492d60a47a8754666b91a46bfc35cd4d1ba" "checksum onig 4.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "3febe8cb22362af9e662c9c35e4d8a675de50b1b119823aa556892ac967fb776"
"checksum onig_sys 68.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "195ebddbb56740be48042ca117b8fb6e0d99fe392191a9362d82f5f69e510379" "checksum onig_sys 69.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "78c04019a39ebac42dfd8c7822af0a009043720845a812ddbb95e403298b0183"
"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.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5" "checksum parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "f0802bff09003b291ba756dc7e79313e51cc31667e94afbe847def490424cde5"
"checksum parking_lot_core 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ad7f7e6ebdc79edff6fdcb87a55b620174f7a989e3eb31b65231f4af57f00b8c" "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.19 (registry+https://github.com/rust-lang/crates.io-index)" = "ffe022fb8c8bd254524b0b3305906c1921fa37a84a644e29079a9e62200c3901" "checksum predicates 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fa984b7cd021a0bf5315bcce4c4ae61d2a535db2a8d288fc7578638690a7b7c3"
"checksum quote 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "dd636425967c33af890042c483632d33fa7a18f19ad1d7ea72e8998c6ef8dea5" "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.21 (registry+https://github.com/rust-lang/crates.io-index)" = "ab2fc21ba78ac73e4ff6b3818ece00be4e175ffbef4d0a717d978b48b24150c4"
"checksum quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "9274b940887ce9addde99c4eee6b5c44cc494b182b97e73dc8ffdcb3397fd3f0"
"checksum quote 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "53fa22a1994bd0f9372d7a816207d8a2677ad0325b073f5c5332760f0fb62b5c"
"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 0.5.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e464cd887e869cddcae8792a4ee31d23c7edd516700695608f5b98c67ee0131c"
"checksum rand_core 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "edecf0f94da5551fc9b492093e30b041a891657db7940ee221f9d2f66e82eef2" "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 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341" "checksum regex 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "ee84f70c8c08744ea9641a731c7fadb475bf2ecc52d7f627feb833e0b3990467"
"checksum regex-syntax 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8e931c58b93d86f080c734bfd2bce7dd0079ae2331235818133c8be7f422e20e" "checksum regex-syntax 0.6.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fbc557aac2b708fe84121caf261346cc2eed71978024337e42eb46b8a252ac6e"
"checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
"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 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.7 (registry+https://github.com/rust-lang/crates.io-index)" = "eb9e9b8cde282a9fe6a42dd4681319bfb63f121b8a8ee9439c6f4107e58a46f7"
"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.4 (registry+https://github.com/rust-lang/crates.io-index)" = "8f20c4be53a8a1ff4c1f1b2bd14570d2f634628709752f0702ecdd2b3f9a5267"
"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 semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum serde 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "84257ccd054dc351472528c8587b4de2dbf0dc0fe2e634030c1a90bfdacebaa9" "checksum serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "15c141fc7027dd265a47c090bf864cf62b42c4d228bbcf4e51a0c9e2b0d3f7ef"
"checksum serde_derive 1.0.79 (registry+https://github.com/rust-lang/crates.io-index)" = "31569d901045afbff7a9479f793177fe9259819aff10ab4f89ef69bbc5f567fe" "checksum serde_derive 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)" = "225de307c6302bec3898c51ca302fc94a7a1697ef0845fcee6448f33c032249c"
"checksum serde_json 1.0.28 (registry+https://github.com/rust-lang/crates.io-index)" = "d30ec34ac923489285d24688c7a9c0898d16edff27fc1f1bd854edeff6ca3b7f" "checksum serde_json 1.0.33 (registry+https://github.com/rust-lang/crates.io-index)" = "c37ccd6be3ed1fdf419ee848f7c758eb31b054d7cd3ae3600e3bae0adf569811"
"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.15.5 (registry+https://github.com/rust-lang/crates.io-index)" = "5522da8e493dbd7703e88ec5518546ed45c30efa2699f291a7bd0a08fb0a6ab6" "checksum syn 0.15.19 (registry+https://github.com/rust-lang/crates.io-index)" = "39054bb43f2c5e4f3aef47718a391bf397c1b820fefc86f467d4d354f67bf7ef"
"checksum syntect 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "dc8a6f0db88d4afc340522c20d260411e746b2225b257c6b238a75de9d7cec78" "checksum syntect 3.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "e02dd9df97a68a2d005ace28ff24c610abfc3ce17afcfdb22a077645dabb599a"
"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.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "70226acdf12d182df757d9fb07c0257a1558ec48c8059f607d6b38145ce4e2fa" "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.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d0f8bfa9ff0cadcd210129ad9d2c5f145c13e9ced3d3e5d948a6213487d52444"
"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"
"checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526"
"checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc"
"checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56" "checksum unreachable 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "382810877fe448991dfc7f0dd6e3ae5d58088fd0ea5e35189655f84e6814fa56"
"checksum url 1.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2a321979c09843d272956e73700d12c4e7d3d92b2ee112b31548aef0d4efc5a6" "checksum url 1.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a"
"checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4" "checksum utf8-ranges 1.0.2 (registry+https://github.com/rust-lang/crates.io-index)" = "796f7e48bef87609f7ade7e06495a87d5cd06c7866e6a5cbfceffc558a243737"
"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.6 (registry+https://github.com/rust-lang/crates.io-index)" = "0ffb549f212c31e19f3667c55a7f515b983a84aef10fd0a4d1f9c125425115f3"
"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.6 (registry+https://github.com/rust-lang/crates.io-index)" = "92c1eb33641e276cfa214a0522acad57be5c56b10cb348b3c5117db75f3ac4b0" "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"
+13 -3
View File
@@ -7,11 +7,12 @@ 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.7.1" version = "0.9.0"
exclude = [ exclude = [
"assets/syntaxes/*", "assets/syntaxes/*",
"assets/themes/*", "assets/themes/*",
] ]
build = "build.rs"
[dependencies] [dependencies]
atty = "0.2.2" atty = "0.2.2"
@@ -19,7 +20,11 @@ ansi_term = "0.11"
ansi_colours = "^1.0" ansi_colours = "^1.0"
console = "0.6" console = "0.6"
directories = "1.0" directories = "1.0"
lazy_static = "1.0" lazy_static = "1.2"
wild = "2.0"
content_inspector = "0.2.4"
encoding = "0.2"
shell-words = "0.1.0"
[dependencies.git2] [dependencies.git2]
version = "0.7" version = "0.7"
@@ -27,7 +32,7 @@ default-features = false
features = [] features = []
[dependencies.syntect] [dependencies.syntect]
version = "2.1" version = "3.0.2"
default-features = false default-features = false
features = ["parsing", "yaml-load", "dump-load", "dump-create"] features = ["parsing", "yaml-load", "dump-load", "dump-create"]
@@ -43,3 +48,8 @@ features = []
[dev-dependencies] [dev-dependencies]
tempdir = "0.3" tempdir = "0.3"
assert_cmd = "0.10.1"
escargot = "0.3.1"
[build-dependencies]
clap = "2.32"
+129 -32
View File
@@ -12,7 +12,8 @@
<a href="#how-to-use">How To Use</a> • <a href="#how-to-use">How To Use</a> •
<a href="#installation">Installation</a> • <a href="#installation">Installation</a> •
<a href="#customization">Customization</a> • <a href="#customization">Customization</a> •
<a href="#project-goals-and-alternatives">Project goals, alternatives</a> <a href="#project-goals-and-alternatives">Project goals, alternatives</a>
Translation [<a href="https://github.com/chinanf-boy/bat-zh">中文</a>]
</p> </p>
### Syntax highlighting ### Syntax highlighting
@@ -29,6 +30,10 @@ languages:
![Git integration example](https://i.imgur.com/2lSW4RE.png) ![Git integration example](https://i.imgur.com/2lSW4RE.png)
### Show non-printable characters
![Non-printable character example](https://i.imgur.com/2KTHhYT.png)
### Automatic paging ### Automatic paging
`bat` can pipe its own output to `less` if the output is too large for one screen. `bat` can pipe its own output to `less` if the output is too large for one screen.
@@ -53,15 +58,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`:
@@ -83,7 +91,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.7.1_amd64.deb # adapt version number and architecture sudo dpkg -i bat_0.9.0_amd64.deb # adapt version number and architecture
``` ```
### On Arch Linux ### On Arch Linux
@@ -117,6 +125,49 @@ 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 openSUSE
You can install `bat` with zypper:
```
zypper install bat
```
### On macOS
You can install `bat` with [Homebrew](http://braumeister.org/formula/bat):
```bash
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 ### Via Ansible
You can install `bat` with [Ansible](https://www.ansible.com/): You can install `bat` with [Ansible](https://www.ansible.com/):
@@ -145,33 +196,16 @@ This should work with the following distributions:
- FreeBSD - FreeBSD
- MacOS - MacOS
### On macOS
You can install `bat` with [Homebrew](http://braumeister.org/formula/bat):
```bash
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.
### 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
@@ -191,6 +225,17 @@ highlighting. To select the `TwoDark` theme, call `bat` with the
`TwoDark`. Use `export BAT_THEME="TwoDark"` in your shell's 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.
@@ -257,13 +302,65 @@ 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 can also set them via the
`PAGER`/`BAT_PAGER` variables:
```bash ```bash
#!/bin/bash export BAT_PAGER="less -RF"
```
less --tabs 4 -RF "$@" **Note**: By default, if the pager is set to `less` (any no command-line options are specified),
`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.
### Configuration file
`bat` can also be customized with a configuration file. The location of the file is dependent on you operating system. To get the default path for your system, call
```
bat --config-file
```
Alternatively, you can use the `BAT_CONFIG_PATH` environment variable to point `bat` to a non-default location of the configuration file:
```bash
export BAT_CONFIG_PATH="/path/to/bat.conf"
```
#### Format
The configuration file is a simple list of command line arguments. Use `bat --help` to see a full list of possible options and values. In addition, you can add comments by prepending a line with the `#` character.
Example configuration file:
```bash
# Set the theme to "TwoDark"
--theme="TwoDark"
# Show line numbers, Git modifications and file header (but no grid)
--style="numbers,changes,header"
# Use italic text on the terminal (not supported on all terminals)
--italic-text=always
# Add mouse scrolling support in less (does not work with older
# versions of "less")
--pager="less -FR"
# Use C++ syntax (instead of C) for .h header files
--map-syntax h:cpp
# Use "gitignore" highlighting for ".ignore" files
--map-syntax .ignore:.gitignore
``` ```
## Using `bat` on Windows ## Using `bat` on Windows
@@ -290,7 +387,7 @@ or by setting `BAT_PAGER` to an empty string.
### Cygwin ### 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)` `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: This can be solved by creating a wrapper or adding the following function to your `.bash_profile` file:
+13
View File
@@ -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
-1
View File
@@ -28,6 +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. * `Dart.sublime-syntax` => removed `#regex.dart` include.
* `INI.sublime-syntax` => added `.hgrc` and `hgrc` file types. * `INI.sublime-syntax` => added `.hgrc` and `hgrc` file types.
Regular → Executable
+11
View File
@@ -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/222 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.
+54
View File
@@ -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
+1 -1
View File
@@ -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+'
@@ -0,0 +1,27 @@
%YAML 1.2
---
# http://www.sublimetext.com/docs/3/syntax.html
name: Highlight non-printables
file_extensions:
- show-nonprintable
scope: whitespace
contexts:
main:
- match: "•"
scope: support.function.show-nonprintable.space
- match: "├─*┤"
scope: constant.character.escape.show-nonprintable.tab
- match: "↹"
scope: constant.character.escape.show-nonprintable.tab
- match: "␊"
scope: keyword.operator.show-nonprintable.line-feed
- match: "␍"
scope: string.show-nonprintable.carriage-return
- match: "␀"
scope: entity.other.attribute-name.show-nonprintable.null
- match: "␇"
scope: entity.other.attribute-name.show-nonprintable.bell
- match: "␛"
scope: entity.other.attribute-name.show-nonprintable.escape
- match: "␈"
scope: entity.other.attribute-name.show-nonprintable.backspace
BIN
View File
Binary file not shown.
+26
View File
@@ -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);
}
+7
View File
@@ -27,6 +27,7 @@ pack() {
# 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/"
@@ -38,6 +39,12 @@ 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
# TODO: disabled for now, see issue #372
# 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"/*
+2
View File
@@ -11,6 +11,8 @@ Set-Location $STAGE
$ZIP = "$SRC_DIR\$($Env:CRATE_NAME)-$($Env:APPVEYOR_REPO_TAG_NAME)-$($Env:TARGET).zip" $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\bat.exe" '.\'
# TODO: disabled for now, see issue #372
# Copy-Item $SRC_DIR\target\release\build\bat-*\out\_bat.ps1 '.\'
# readme and license # readme and license
Copy-Item $SRC_DIR\README.md '.\' Copy-Item $SRC_DIR\README.md '.\'
+59 -39
View File
@@ -12,20 +12,25 @@ bat <SUBCOMMAND>
.HP .HP
\fB\-l\fR, \fB\-\-language\fR <language> \fB\-l\fR, \fB\-\-language\fR <language>
.IP .IP
Explicitly set the language for syntax highlighting. The language can be Explicitly set the language for syntax highlighting. The language can be specified as a
specified as a name (like 'C++' or 'LaTeX') or possible file extension (like name (like 'C++' or 'LaTeX') or possible file extension (like 'cpp', 'hpp' or 'md'). Use
\&'cpp', 'hpp' or 'md'). Use '\-\-list\-languages' to show all supported language \&'\-\-list\-languages' to show all supported language names and file extensions.
names and file extensions.
.HP .HP
\fB\-\-list\-languages\fR \fB\-\-list\-languages\fR
.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 available themes.
available themes. To set a default theme, export the BAT_THEME environment To set a default theme, add the '\-\-theme="..."' option to the configuration file or
variable (e.g.: export BAT_THEME="TwoDark"). export the BAT_THEME environment variable (e.g.: export BAT_THEME="...").
.HP .HP
\fB\-\-list\-themes\fR \fB\-\-list\-themes\fR
.IP .IP
@@ -33,24 +38,27 @@ Display a list of supported themes for syntax highlighting.
.HP .HP
\fB\-\-style\fR <style\-components> \fB\-\-style\fR <style\-components>
.IP .IP
Configure which elements (line numbers, file headers, grid borders, Git Configure which elements (line numbers, file headers, grid borders, Git modifications,
modifications, ..) to display in addition to the file contents. The argument \&..) to display in addition to the file contents. The argument is a comma\-separated list
is a comma\-separated list of components to display (e.g. of components to display (e.g. 'numbers,changes,grid') or a pre\-defined style ('full').
\&'numbers,changes,grid') or a pre\-defined style ('full'). To set a default To set a default style, add the '\-\-style=".."' option to the configuration file or
theme, export the BAT_STYLE environment variable (e.g.: export export the BAT_STYLE environment variable (e.g.: export BAT_STYLE=".."). Possible
BAT_STYLE="numbers"). [possible values: auto, full, plain, changes, header, values: *auto*, full, plain, changes, header, grid, numbers.
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
\fB\-n\fR, \fB\-\-number\fR \fB\-n\fR, \fB\-\-number\fR
.IP .IP
Only show line numbers, no other decorations. This is an alias for Only show line numbers, no other decorations. This is an alias for '\-\-style=numbers'
\&'\-\-style=numbers'
.HP .HP
\fB\-\-line\-range\fR <N:M> \fB\-A\fR, \fB\-\-show\-all\fR
.IP
Show non\-printable characters like space, tab or newline. Use '\-\-tabs' to control the
width of the tab\-placeholders.
.HP
\fB\-\-line\-range\fR <N:M>...
.IP .IP
Only print the specified range of lines for each file. For example: Only print the specified range of lines for each file. For example:
.RS .RS
@@ -64,38 +72,51 @@ 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
\fB\-\-italic\-text\fR <when>
.IP
Specify when to use ANSI sequences for italic text in the output. Possible values:
always, *never*.
.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) or use the '\-\-pager'
pager is 'less'. To disable the pager permanently, set BAT_PAGER to an empty option. To disable the pager permanently, set BAT_PAGER to an empty string or set
string. [default: auto] [possible values: auto, never, always] \&'\-\-paging=never' in the configuration file. Possible values: *auto*, never, always.
.HP
\fB\-\-pager\fR <command>
.IP
Determine which pager is used. This option will overwrite the PAGER and BAT_PAGER
environment variables. The default pager is 'less'. To disable the pager completely, use
the '\-\-paging' option. Example: '\-\-pager "less \fB\-RF\fR"'.
.HP .HP
\fB\-\-wrap\fR <mode> \fB\-\-wrap\fR <mode>
.TP
Specify the text\-wrapping mode. [default: auto]
[possible values: auto,
.IP .IP
never, character] Specify the text\-wrapping mode (*auto*, never, character).
.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 .HP
\fB\-\-tabs\fR <tabs> \fB\-u\fR, \fB\-\-unbuffered\fR
.IP .IP
Sets the tab width. Use a width of 0 to pass tabs through directly This option exists for POSIX\-compliance reasons ('u' is for 'unbuffered'). The output is
always unbuffered \- this option is simply ignored.
.HP
\fB\-\-terminal\-width\fR <width>
.IP
Explicitly set the width of the terminal instead of determining it automatically. If
prefixed with '+' or '\-', the value will be treated as an offset to the actual terminal
width.
.HP .HP
\fB\-h\fR, \fB\-\-help\fR \fB\-h\fR, \fB\-\-help\fR
.IP .IP
@@ -113,5 +134,4 @@ from standard input.
.SH "SUBCOMMANDS" .SH "SUBCOMMANDS"
.IP .IP
cache cache
.IP Modify the syntax\-definition and theme cache
Modify the syntax\-definition and theme cache. See "bat cache --help" for more information
+137 -300
View File
@@ -1,11 +1,12 @@
use std::collections::HashSet; use std::collections::HashSet;
use std::env; use std::env;
use std::path::Path;
use std::str::FromStr; 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;
@@ -13,9 +14,13 @@ 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 line_range::LineRange; use inputfile::InputFile;
use line_range::{LineRange, LineRanges};
use style::{OutputComponent, OutputComponents, OutputWrap}; use style::{OutputComponent, OutputComponents, OutputWrap};
use syntax_mapping::SyntaxMapping;
use util::transpose;
#[derive(Debug, Clone, Copy, PartialEq)] #[derive(Debug, Clone, Copy, PartialEq)]
pub enum PagingMode { pub enum PagingMode {
@@ -24,13 +29,6 @@ pub enum PagingMode {
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
@@ -39,6 +37,9 @@ pub struct Config<'a> {
/// The explicitly configured language, if any /// The explicitly configured language, if any
pub language: Option<&'a str>, pub language: Option<&'a str>,
/// Whether or not to show/replace non-printable characters like space, tab and newline.
pub show_nonprintable: bool,
/// The character width of the terminal /// The character width of the terminal
pub term_width: usize, pub term_width: usize,
@@ -64,11 +65,19 @@ pub struct Config<'a> {
/// Pager or STDOUT /// Pager or STDOUT
pub paging_mode: PagingMode, pub paging_mode: PagingMode,
/// The range lines that should be printed, if specified /// Specifies the lines that should be printed
pub line_range: Option<LineRange>, pub line_ranges: LineRanges,
/// The syntax highlighting theme /// The syntax highlighting theme
pub theme: String, pub theme: String,
/// File extension/name mappings
pub syntax_mapping: SyntaxMapping,
/// Command to start the pager
pub pager: Option<&'a str>,
pub use_italic_text: bool,
} }
fn is_truecolor_terminal() -> bool { fn is_truecolor_terminal() -> bool {
@@ -77,284 +86,49 @@ 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)] #[cfg(windows)]
let _ = ansi_term::enable_ansi_support(); let _ = ansi_term::enable_ansi_support();
let interactive_output = atty::is(Stream::Stdout); let interactive_output = atty::is(Stream::Stdout);
App { Ok(App {
matches: Self::matches(interactive_output), 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
}; };
// Check if the current directory contains a file name cache, if it does Ok(clap_app::build_app(interactive_output).get_matches_from(args))
// 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::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",
])
.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'). To set a default theme, export the \
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"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"])
.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(&["auto", "never", "character"])
.default_value("auto")
.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.",
),
).arg(
Arg::with_name("tabs")
.long("tabs")
.takes_value(true)
.value_name("tabs")
.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("Sets the tab width.")
.long_help("Sets the tab width. Use a width of 0 to pass tabs through \
directly"),
).arg(
Arg::with_name("terminal-width")
.long("terminal-width")
.takes_value(true)
.value_name("width")
.hidden(true)
.help("Set the width of the terminal"),
).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.")
.get_matches()
} }
pub fn config(&self) -> Result<Config> { pub fn config(&self) -> Result<Config> {
@@ -364,27 +138,50 @@ impl App {
let paging_mode = match self.matches.value_of("paging") { let paging_mode = match self.matches.value_of("paging") {
Some("always") => PagingMode::Always, Some("always") => PagingMode::Always,
Some("never") => PagingMode::Never, Some("never") => PagingMode::Never,
Some("auto") | _ => if files.contains(&InputFile::StdIn) { Some("auto") | _ => {
// If we are reading from stdin, only enable paging if we write to an if files.contains(&InputFile::StdIn) {
// interactive terminal and if we do not *read* from an interactive // If we are reading from stdin, only enable paging if we write to an
// terminal. // interactive terminal and if we do not *read* from an interactive
if self.interactive_output && !atty::is(Stream::Stdin) { // terminal.
PagingMode::QuitIfOneScreen if self.interactive_output && !atty::is(Stream::Stdin) {
PagingMode::QuitIfOneScreen
} else {
PagingMode::Never
}
} else { } else {
PagingMode::Never if self.interactive_output {
PagingMode::QuitIfOneScreen
} else {
PagingMode::Never
}
} }
} else { }
if self.interactive_output {
PagingMode::QuitIfOneScreen
} else {
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 { Ok(Config {
true_color: is_truecolor_terminal(), true_color: is_truecolor_terminal(),
language: self.matches.value_of("language"), language: self.matches.value_of("language").or_else(|| {
if self.matches.is_present("show-all") {
Some("show-nonprintable")
} else {
None
}
}),
show_nonprintable: self.matches.is_present("show-all"),
output_wrap: if !self.interactive_output { output_wrap: if !self.interactive_output {
// We don't have the tty width when piping to another program. // We don't have the tty width when piping to another program.
// There's no point in wrapping when this is the case. // There's no point in wrapping when this is the case.
@@ -393,11 +190,13 @@ impl App {
match self.matches.value_of("wrap") { match self.matches.value_of("wrap") {
Some("character") => OutputWrap::Character, Some("character") => OutputWrap::Character,
Some("never") => OutputWrap::None, Some("never") => OutputWrap::None,
Some("auto") | _ => if output_components.plain() { Some("auto") | _ => {
OutputWrap::None if output_components.plain() {
} else { OutputWrap::None
OutputWrap::Character } else {
}, OutputWrap::Character
}
}
} }
}, },
colored_output: match self.matches.value_of("color") { colored_output: match self.matches.value_of("color") {
@@ -409,7 +208,23 @@ impl App {
term_width: self term_width: self
.matches .matches
.value_of("terminal-width") .value_of("terminal-width")
.and_then(|w| w.parse().ok()) .and_then(|w| {
if w.starts_with("+") || w.starts_with("-") {
// Treat argument as a delta to the current terminal width
w.parse().ok().map(|delta: i16| {
let old_width: u16 = Term::stdout().size().1;
let new_width: i32 = old_width as i32 + delta as i32;
if new_width <= 0 {
old_width as usize
} else {
new_width as usize
}
})
} else {
w.parse().ok()
}
})
.unwrap_or(Term::stdout().size().1 as usize), .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")
@@ -425,7 +240,7 @@ impl App {
if output_components.plain() && paging_mode == PagingMode::Never { if output_components.plain() && paging_mode == PagingMode::Never {
0 0
} else { } else {
8 4
}, },
), ),
theme: self theme: self
@@ -434,8 +249,21 @@ impl App {
.map(String::from) .map(String::from)
.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_ranges: LineRanges::from(
transpose(
self.matches
.values_of("line-range")
.map(|vs| vs.map(LineRange::from).collect()),
)?
.unwrap_or(vec![]),
),
output_components, output_components,
syntax_mapping,
pager: self.matches.value_of("pager"),
use_italic_text: match self.matches.value_of("italic-text") {
Some("always") => true,
_ => false,
},
}) })
} }
@@ -450,8 +278,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> {
@@ -472,8 +302,15 @@ impl App {
.collect::<Result<Vec<OutputComponent>>>() .collect::<Result<Vec<OutputComponent>>>()
}))?; }))?;
values_t!(matches.values_of("style"), OutputComponent) matches
.ok() .value_of("style")
.map(|styles| {
styles
.split(",")
.map(|style| style.parse::<OutputComponent>())
.filter_map(|style| style.ok())
.collect::<Vec<_>>()
})
.or(env_style_components) .or(env_style_components)
.unwrap_or(vec![OutputComponent::Full]) .unwrap_or(vec![OutputComponent::Full])
.into_iter() .into_iter()
+67 -74
View File
@@ -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")
} }
+393
View File
@@ -0,0 +1,393 @@
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, add the \
'--theme=\"...\"' option to the configuration file or export the \
BAT_THEME environment variable (e.g.: export \
BAT_THEME=\"...\").",
),
)
.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")
// Need to turn this off for overrides_with to work as we want. See the bottom most
// example at https://docs.rs/clap/2.32.0/clap/struct.Arg.html#method.overrides_with
.use_delimiter(false)
.takes_value(true)
.overrides_with("style")
.overrides_with("plain")
.overrides_with("number")
// Cannot use clap's built in validation because we have to turn off clap's delimiters
.validator(|val| {
let mut invalid_vals = val.split(",").filter(|style| {
!&[
"auto", "full", "plain", "changes", "header", "grid", "numbers",
]
.contains(style)
});
if let Some(invalid) = invalid_vals.next() {
Err(format!("Unknown style, '{}'", invalid))
} else {
Ok(())
}
})
.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 style, add the \
'--style=\"..\"' option to the configuration file or export the \
BAT_STYLE environment variable (e.g.: export BAT_STYLE=\"..\"). \
Possible values: *auto*, full, plain, changes, header, grid, numbers.",
),
)
.arg(
Arg::with_name("plain")
.overrides_with("plain")
.overrides_with("number")
.short("p")
.long("plain")
.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")
.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("show-all")
.long("show-all")
.alias("show-nonprintable")
.short("A")
.conflicts_with("language")
.help("Show non-printable characters (space, tab, newline, ..).")
.long_help(
"Show non-printable characters like space, tab or newline. \
Use '--tabs' to control the width of the tab-placeholders.",
),
)
.arg(
Arg::with_name("line-range")
.long("line-range")
.multiple(true)
.takes_value(true)
.number_of_values(1)
.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("italic-text")
.long("italic-text")
.takes_value(true)
.value_name("when")
.possible_values(&["always", "never"])
.default_value("never")
.hide_default_value(true)
.help("Use italics in output (always, *never*)")
.long_help("Specify when to use ANSI sequences for italic text in the output. Possible values: always, *never*."),
)
.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) or use the '--pager' option. \
To disable the pager permanently, set BAT_PAGER to an empty string \
or set '--paging=never' in the configuration file. \
Possible values: *auto*, never, always.",
),
)
.arg(
Arg::with_name("pager")
.long("pager")
.overrides_with("pager")
.takes_value(true)
.value_name("command")
.hidden_short_help(true)
.help("Determine which pager to use.")
.long_help(
"Determine which pager is used. This option will overwrite \
the PAGER and BAT_PAGER environment variables. The default \
pager is 'less'. To disable the pager completely, use the \
'--paging' option. \
Example: '--pager \"less -RF\"'.",
),
)
.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_short_help(true)
.help(
"Explicitly set the width of the terminal instead of determining it \
automatically. If prefixed with '+' or '-', the value will be treated \
as an offset to the actual terminal width.",
),
)
.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.")
}
+105
View File
@@ -0,0 +1,105 @@
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 {
env::var("BAT_CONFIG_PATH")
.ok()
.map(PathBuf::from)
.filter(|config_path| config_path.is_file())
.unwrap_or(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 -61
View File
@@ -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 line_range::LineRange; use inputfile::{InputFile, InputFileReader};
use line_range::{LineRanges, RangeCheckResult};
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, self.config.pager)?;
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,30 +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_ranges)?;
let reader: Box<BufRead> = match filename { printer.print_footer(writer)?;
InputFile::StdIn => Box::new(stdin.lock()),
InputFile::Ordinary(filename) => {
let file = File::open(filename)?;
if file.metadata()?.is_dir() {
return Err(format!("'{}' is a directory.", filename).into());
}
Box::new(BufReader::new(file))
}
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(())
} }
@@ -76,35 +74,28 @@ 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: &LineRanges,
) -> 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.check(line_number) {
match line_ranges { RangeCheckResult::OutsideRange => {
&Some(ref range) => { // Call the printer in case we need to call the syntax highlighter
if line_number < range.lower { // for this line. However, set `out_of_range` to `true`.
// Call the printer in case we need to call the syntax highlighter printer.print_line(true, writer, line_number, &line_buffer)?;
// for this line. However, set `out_of_range` to `true`. }
printer.print_line(true, writer, line_number, &line_buffer)?; RangeCheckResult::InRange => {
} else if line_number > range.upper { printer.print_line(false, writer, line_number, &line_buffer)?;
// no more lines in range, exit early }
break; RangeCheckResult::AfterLastRange => {
} else { break;
printer.print_line(false, writer, line_number, &line_buffer)?;
}
}
&None => {
printer.print_line(false, writer, line_number, &line_buffer)?;
}
} }
line_number += 1;
} }
line_number += 1;
line_buffer.clear(); line_buffer.clear();
} }
Ok(()) Ok(())
+6
View File
@@ -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");
}
+131
View File
@@ -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());
}
+106
View File
@@ -38,6 +38,10 @@ impl LineRange {
Err("expected single ':' character".into()) Err("expected single ':' character".into())
} }
pub fn is_inside(&self, line: usize) -> bool {
line >= self.lower && line <= self.upper
}
} }
#[test] #[test]
@@ -72,3 +76,105 @@ fn test_parse_fail() {
let range = LineRange::from("40"); let range = LineRange::from("40");
assert!(range.is_err()); assert!(range.is_err());
} }
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum RangeCheckResult {
// Within one of the given ranges
InRange,
// Before the first range or within two ranges
OutsideRange,
// Line number is outside of all ranges and larger than the last range.
AfterLastRange,
}
#[derive(Clone)]
pub struct LineRanges {
ranges: Vec<LineRange>,
largest_upper_bound: usize,
}
impl LineRanges {
pub fn from(ranges: Vec<LineRange>) -> LineRanges {
let largest_upper_bound = ranges
.iter()
.map(|r| r.upper)
.max()
.unwrap_or(usize::max_value());
LineRanges {
ranges,
largest_upper_bound,
}
}
pub fn check(&self, line: usize) -> RangeCheckResult {
if self.ranges.is_empty() {
RangeCheckResult::InRange
} else {
if self.ranges.iter().any(|r| r.is_inside(line)) {
RangeCheckResult::InRange
} else {
if line < self.largest_upper_bound {
RangeCheckResult::OutsideRange
} else {
RangeCheckResult::AfterLastRange
}
}
}
}
}
#[cfg(test)]
fn ranges(rs: &[&str]) -> LineRanges {
LineRanges::from(rs.iter().map(|r| LineRange::from(r).unwrap()).collect())
}
#[test]
fn test_ranges_simple() {
let ranges = ranges(&["3:8"]);
assert_eq!(RangeCheckResult::OutsideRange, ranges.check(2));
assert_eq!(RangeCheckResult::InRange, ranges.check(5));
assert_eq!(RangeCheckResult::AfterLastRange, ranges.check(9));
}
#[test]
fn test_ranges_advanced() {
let ranges = ranges(&["3:8", "11:20", "25:30"]);
assert_eq!(RangeCheckResult::OutsideRange, ranges.check(2));
assert_eq!(RangeCheckResult::InRange, ranges.check(5));
assert_eq!(RangeCheckResult::OutsideRange, ranges.check(9));
assert_eq!(RangeCheckResult::InRange, ranges.check(11));
assert_eq!(RangeCheckResult::OutsideRange, ranges.check(22));
assert_eq!(RangeCheckResult::InRange, ranges.check(28));
assert_eq!(RangeCheckResult::AfterLastRange, ranges.check(31));
}
#[test]
fn test_ranges_open_low() {
let ranges = ranges(&["3:8", ":5"]);
assert_eq!(RangeCheckResult::InRange, ranges.check(1));
assert_eq!(RangeCheckResult::InRange, ranges.check(3));
assert_eq!(RangeCheckResult::InRange, ranges.check(7));
assert_eq!(RangeCheckResult::AfterLastRange, ranges.check(9));
}
#[test]
fn test_ranges_open_high() {
let ranges = ranges(&["3:", "2:5"]);
assert_eq!(RangeCheckResult::OutsideRange, ranges.check(1));
assert_eq!(RangeCheckResult::InRange, ranges.check(3));
assert_eq!(RangeCheckResult::InRange, ranges.check(5));
assert_eq!(RangeCheckResult::InRange, ranges.check(9));
}
#[test]
fn test_ranges_empty() {
let ranges = ranges(&[]);
assert_eq!(RangeCheckResult::InRange, ranges.check(1));
}
+18 -2
View File
@@ -13,21 +13,31 @@ 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 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;
@@ -38,9 +48,11 @@ 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 {
@@ -186,7 +198,7 @@ fn run_controller(config: &Config) -> Result<bool> {
/// 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)) => {
@@ -213,6 +225,10 @@ fn run() -> Result<bool> {
} else if app.matches.is_present("list-themes") { } else if app.matches.is_present("list-themes") {
list_themes(&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 {
run_controller(&config) run_controller(&config)
+48 -27
View File
@@ -4,6 +4,8 @@ use std::io::{self, Write};
use std::path::PathBuf; 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::*;
@@ -13,42 +15,61 @@ pub enum OutputType {
} }
impl OutputType { impl OutputType {
pub fn from_mode(mode: PagingMode) -> Self { pub fn from_mode(mode: PagingMode, pager: Option<&str>) -> Result<Self> {
use self::PagingMode::*; use self::PagingMode::*;
match mode { Ok(match mode {
Always => OutputType::try_pager(false), Always => OutputType::try_pager(false, pager)?,
QuitIfOneScreen => OutputType::try_pager(true), QuitIfOneScreen => OutputType::try_pager(true, pager)?,
_ => 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, pager_from_config: Option<&str>) -> Result<Self> {
let pager = env::var("BAT_PAGER") let pager_from_env = env::var("BAT_PAGER").or_else(|_| env::var("PAGER"));
.or_else(|_| env::var("PAGER"))
let pager = pager_from_config
.map(|p| p.to_string())
.or(pager_from_env.ok())
.unwrap_or(String::from("less")); .unwrap_or(String::from("less"));
let less_path = PathBuf::from(&pager); let pagerflags = shell_words::split(&pager)
let is_less = less_path.file_stem() == Some(&OsString::from("less")); .chain_err(|| "Could not parse (BAT_)PAGER environment variable.")?;
let mut process = if is_less { match pagerflags.split_first() {
let mut args = vec!["--RAW-CONTROL-CHARS", "--no-init"]; Some((pager_name, mut args)) => {
if quit_if_one_screen { let mut pager_path = PathBuf::from(pager_name);
args.push("--quit-if-one-screen");
if pager_path.file_stem() == Some(&OsString::from("bat")) {
pager_path = PathBuf::from("less");
args = &[];
}
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_path); }
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 {
+40 -1
View File
@@ -1,7 +1,7 @@
use console::AnsiCodeIterator; use console::AnsiCodeIterator;
/// Expand tabs like an ANSI-enabled expand(1). /// Expand tabs like an ANSI-enabled expand(1).
pub fn expand(line: &str, width: usize, cursor: &mut usize) -> String { pub fn expand_tabs(line: &str, width: usize, cursor: &mut usize) -> String {
let mut buffer = String::with_capacity(line.len() * 2); let mut buffer = String::with_capacity(line.len() * 2);
for chunk in AnsiCodeIterator::new(line) { for chunk in AnsiCodeIterator::new(line) {
@@ -32,3 +32,42 @@ pub fn expand(line: &str, width: usize, cursor: &mut usize) -> String {
buffer buffer
} }
pub fn replace_nonprintable(input: &str, tab_width: usize) -> String {
let mut output = String::new();
let tab_width = if tab_width == 0 { 4 } else { tab_width };
for chr in input.chars() {
match chr {
// space
' ' => output.push('•'),
// tab
'\t' => {
if tab_width == 1 {
output.push('↹');
} else {
output.push('├');
output.push_str(&"".repeat(tab_width - 2));
output.push('┤');
}
}
// line feed
'\x0A' => output.push('␊'),
// carriage return
'\x0D' => output.push('␍'),
// null
'\x00' => output.push('␀'),
// bell
'\x07' => output.push('␇'),
// backspace
'\x08' => output.push('␈'),
// escape
'\x1B' => output.push('␛'),
// anything else
_ => output.push(chr),
}
}
output
}
+93 -27
View File
@@ -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,14 +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 preprocessor::expand; use inputfile::{InputFile, InputFileReader};
use preprocessor::{expand_tabs, replace_nonprintable};
use style::OutputWrap; use style::OutputWrap;
use terminal::{as_terminal_escaped, to_ansi_color}; use terminal::{as_terminal_escaped, to_ansi_color};
@@ -66,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 {
@@ -84,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)));
@@ -113,28 +126,36 @@ impl<'a> InteractivePrinter<'a> {
panel_width = 0; panel_width = 0;
} }
// Get the Git modifications let mut line_changes = None;
let 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 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,
} }
} }
@@ -156,7 +177,7 @@ impl<'a> InteractivePrinter<'a> {
fn preprocess(&self, text: &str, cursor: &mut usize) -> String { fn preprocess(&self, text: &str, cursor: &mut usize) -> String {
if self.config.tab_width > 0 { if self.config.tab_width > 0 {
expand(text, self.config.tab_width, cursor) expand_tabs(text, self.config.tab_width, cursor)
} else { } else {
text.to_string() text.to_string()
} }
@@ -189,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(())
@@ -213,8 +251,32 @@ 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).to_string(); let mut 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(),
};
if self.config.show_nonprintable {
line = replace_nonprintable(&mut line, self.config.tab_width);
}
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(());
@@ -243,13 +305,14 @@ impl<'a> Printer for InteractivePrinter<'a> {
if self.config.output_wrap == OutputWrap::None { if self.config.output_wrap == OutputWrap::None {
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;
let italics = self.config.use_italic_text;
for &(style, region) in regions.iter() { for &(style, region) in regions.iter() {
let text = &*self.preprocess(region, &mut cursor_total); let text = &*self.preprocess(region, &mut cursor_total);
write!( write!(
handle, handle,
"{}", "{}",
as_terminal_escaped(style, &*text, true_color, colored_output,) as_terminal_escaped(style, &*text, true_color, colored_output, italics,)
)?; )?;
} }
@@ -305,6 +368,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
), ),
self.config.true_color, self.config.true_color,
self.config.colored_output, self.config.colored_output,
self.config.use_italic_text
) )
)?; )?;
break; break;
@@ -319,7 +383,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 {
@@ -343,6 +408,7 @@ impl<'a> Printer for InteractivePrinter<'a> {
), ),
self.config.true_color, self.config.true_color,
self.config.colored_output, self.config.colored_output,
self.config.use_italic_text
), ),
panel_wrap.clone().unwrap() panel_wrap.clone().unwrap()
)?; )?;
+7 -5
View File
@@ -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],
+35
View File
@@ -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"));
}
+2 -1
View File
@@ -18,6 +18,7 @@ pub fn as_terminal_escaped(
text: &str, text: &str,
true_color: bool, true_color: bool,
colored: bool, colored: bool,
italics: bool,
) -> String { ) -> String {
let style = if !colored { let style = if !colored {
Style::default() Style::default()
@@ -28,7 +29,7 @@ pub fn as_terminal_escaped(
color.bold() color.bold()
} else if style.font_style.contains(FontStyle::UNDERLINE) { } else if style.font_style.contains(FontStyle::UNDERLINE) {
color.underline() color.underline()
} else if style.font_style.contains(FontStyle::ITALIC) { } else if italics && style.font_style.contains(FontStyle::ITALIC) {
color.italic() color.italic()
} else { } else {
color.normal() color.normal()
+27
View File
@@ -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));
}
}
+2
View File
@@ -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" \
+5
View File
@@ -0,0 +1,5 @@
# Make sure that the pager gets executed
--paging=always
# Output a dummy message for the integration test.
--pager="echo dummy-pager-from-config"
+4
View File
@@ -0,0 +1,4 @@
line 1
line 2
line 3
line 4
+9
View File
@@ -0,0 +1,9 @@
1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
+1
View File
@@ -0,0 +1 @@
hello world
+365
View File
@@ -0,0 +1,365 @@
extern crate assert_cmd;
extern crate escargot;
#[macro_use]
extern crate lazy_static;
use assert_cmd::prelude::*;
use escargot::CargoRun;
use std::process::Command;
lazy_static! {
static ref CARGO_RUN: CargoRun = escargot::CargoBuild::new()
.bin("bat")
.current_release()
.run()
.unwrap();
}
fn bat_with_config() -> Command {
let mut cmd = CARGO_RUN.command();
cmd.current_dir("tests/examples");
cmd.env_remove("PAGER");
cmd.env_remove("BAT_PAGER");
cmd.env_remove("BAT_CONFIG_PATH");
cmd.env_remove("BAT_STYLE");
cmd.env_remove("BAT_THEME");
cmd.env_remove("BAT_TABS");
cmd
}
fn bat() -> Command {
let mut cmd = bat_with_config();
cmd.arg("--no-config");
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 line_range_multiple() {
bat()
.arg("multiline.txt")
.arg("--line-range=1:2")
.arg("--line-range=4:4")
.assert()
.success()
.stdout("line 1\nline 2\nline 4\n");
}
#[test]
fn tabs_numbers() {
bat()
.arg("tabs.txt")
.arg("--tabs=4")
.arg("--style=numbers")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 1 2 3 4
2 1 ?
3 22 ?
4 333 ?
5 4444 ?
6 55555 ?
7 666666 ?
8 7777777 ?
9 88888888 ?
",
);
}
#[test]
fn tabs_passthrough_wrapped() {
bat()
.arg("tabs.txt")
.arg("--tabs=0")
.arg("--style=plain")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
",
);
}
#[test]
fn tabs_4_wrapped() {
bat()
.arg("tabs.txt")
.arg("--tabs=4")
.arg("--style=plain")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
",
);
}
#[test]
fn tabs_8_wrapped() {
bat()
.arg("tabs.txt")
.arg("--tabs=8")
.arg("--style=plain")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
",
);
}
#[test]
fn tabs_passthrough() {
bat()
.arg("tabs.txt")
.arg("--tabs=0")
.arg("--style=plain")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
",
);
}
#[test]
fn tabs_4() {
bat()
.arg("tabs.txt")
.arg("--tabs=4")
.arg("--style=plain")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
",
);
}
#[test]
fn tabs_8() {
bat()
.arg("tabs.txt")
.arg("--tabs=8")
.arg("--style=plain")
.arg("--decorations=always")
.assert()
.success()
.stdout(
" 1 2 3 4
1 ?
22 ?
333 ?
4444 ?
55555 ?
666666 ?
7777777 ?
88888888 ?
",
);
}
#[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");
}
#[test]
fn config_location_test() {
bat_with_config()
.env("BAT_CONFIG_PATH", "bat.conf")
.arg("--config-file")
.assert()
.success()
.stdout("bat.conf\n");
}
#[test]
fn config_read_arguments_from_file() {
bat_with_config()
.env("BAT_CONFIG_PATH", "bat.conf")
.arg("test.txt")
.assert()
.success()
.stdout("dummy-pager-from-config\n");
}
+35
View File
@@ -0,0 +1,35 @@
mod tester;
use tester::BatTester;
macro_rules! snapshot_tests {
($($test_name: ident: $style: expr,)*) => {
$(
#[test]
fn $test_name() {
let bat_tester = BatTester::new();
bat_tester.test_snapshot(stringify!($test_name), $style);
}
)*
};
}
snapshot_tests! {
changes: "changes",
grid: "grid",
header: "header",
numbers: "numbers",
changes_grid: "changes,grid",
changes_header: "changes,header",
changes_numbers: "changes,numbers",
grid_header: "grid,header",
grid_numbers: "grid,numbers",
header_numbers: "header,numbers",
changes_grid_header: "changes,grid,header",
changes_grid_numbers: "changes,grid,numbers",
changes_header_numbers: "changes,header,numbers",
grid_header_numbers: "grid,header,numbers",
changes_grid_header_numbers: "changes,grid,header,numbers",
full: "full",
plain: "plain",
}
-7
View File
@@ -17,13 +17,6 @@ def generate_snapshots():
for style in collective_styles: for style in collective_styles:
generate_style_snapshot(style) generate_style_snapshot(style)
generate_snapshot("tabs_passthrough", "--tabs=0 --style=full --wrap=never")
generate_snapshot("tabs_passthrough_wrapped", "--tabs=0 --style=full --wrap=character")
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): def generate_style_snapshot(style):
generate_snapshot(style.replace(",", "_"), "--style={}".format(style)) generate_snapshot(style.replace(",", "_"), "--style={}".format(style))
+1 -15
View File
@@ -16,21 +16,7 @@ _ 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 ?
~ */
@@ -16,22 +16,8 @@ _ │ 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 ?
~ │ */
──┴───────────────────────────────────────────────────────────────────────────── ──┴─────────────────────────────────────────────────────────────────────────────
@@ -19,22 +19,8 @@ _ │ 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 ?
~ │ */
──┴───────────────────────────────────────────────────────────────────────────── ──┴─────────────────────────────────────────────────────────────────────────────
@@ -19,22 +19,8 @@
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 ~ │ */
───────┴──────────────────────────────────────────────────────────────────────── ───────┴────────────────────────────────────────────────────────────────────────
@@ -16,22 +16,8 @@
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 ~ │ */
───────┴──────────────────────────────────────────────────────────────────────── ───────┴────────────────────────────────────────────────────────────────────────
@@ -17,21 +17,7 @@ _ 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 ?
~ */
@@ -17,21 +17,7 @@
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 ~ */
@@ -16,21 +16,7 @@
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 ~ */
+1 -15
View File
@@ -19,22 +19,8 @@
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 ~ │ */
───────┴──────────────────────────────────────────────────────────────────────── ───────┴────────────────────────────────────────────────────────────────────────
-14
View File
@@ -20,18 +20,4 @@ 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 ?
*/
──────────────────────────────────────────────────────────────────────────────── ────────────────────────────────────────────────────────────────────────────────
@@ -23,18 +23,4 @@ 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 ?
*/
──────────────────────────────────────────────────────────────────────────────── ────────────────────────────────────────────────────────────────────────────────
@@ -23,18 +23,4 @@
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,18 +20,4 @@
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,17 +21,3 @@ 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 ?
*/
@@ -21,17 +21,3 @@
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,17 +20,3 @@
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
View File
@@ -20,17 +20,3 @@ 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 ?
*/
@@ -1,40 +0,0 @@
───────┬────────────────────────────────────────────────────────────────────────
│ 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 ~ │ */
───────┴────────────────────────────────────────────────────────────────────────
@@ -1,40 +0,0 @@
───────┬────────────────────────────────────────────────────────────────────────
│ 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 ~ │ */
───────┴────────────────────────────────────────────────────────────────────────
@@ -1,40 +0,0 @@
───────┬────────────────────────────────────────────────────────────────────────
│ 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 ~ │ */
───────┴────────────────────────────────────────────────────────────────────────
@@ -1,40 +0,0 @@
───────┬────────────────────────────────────────────────────────────────────────
│ 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 ~ │ */
───────┴────────────────────────────────────────────────────────────────────────
@@ -1,40 +0,0 @@
───────┬────────────────────────────────────────────────────────────────────────
│ 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 ~ │ */
───────┴────────────────────────────────────────────────────────────────────────
@@ -1,40 +0,0 @@
───────┬────────────────────────────────────────────────────────────────────────
│ 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 ~ │ */
───────┴────────────────────────────────────────────────────────────────────────
-14
View File
@@ -20,17 +20,3 @@ 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
View File
@@ -16,17 +16,3 @@ 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 ?
*/
+4 -4
View File
@@ -38,19 +38,19 @@ impl BatTester {
BatTester { temp_dir, exe } BatTester { temp_dir, exe }
} }
pub fn test_snapshot(&self, name: &str, style: &str, tab_width: u32, wrap: bool) { pub fn test_snapshot(&self, name: &str, style: &str) {
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", "--paging=never",
"--color=never", "--color=never",
"--decorations=always", "--decorations=always",
"--terminal-width=80", "--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
-41
View File
@@ -1,41 +0,0 @@
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],
}