Commit Graph

79 Commits

Author SHA1 Message Date
rhysd 8e66bc8722 Make the error handler `FnMut` 2024-01-17 22:00:29 +01:00
Anomalocaridid e32ad0b048
Add `$LESSOPEN` and `$LESSCLOSE` support (#2444) 2023-09-02 08:48:26 +02:00
Peter Hebden 72e1a40bab Remove leftover unwrap 2023-09-01 20:52:55 +02:00
Peter Hebden 906e774372 Handle todos 2023-09-01 20:52:55 +02:00
Peter Hebden d929becefc Fix signatures 2023-09-01 20:52:55 +02:00
Peter Hebden 103a2f0d9b Add `OutputHandle` enum to use instead of `&mut dyn io::Write` 2023-09-01 20:52:55 +02:00
rhysd f28d9db3d0 use io::Empty instead of crafted dummy stdin struct 2021-10-23 13:04:24 +02:00
rhysd deb80af449 remove unused lifetime parameter 2021-10-23 13:04:24 +02:00
rhysd dc0acbbb90 inline a closure which is called only once 2021-10-23 13:04:24 +02:00
rhysd 92ba42a602 do not take stdin lock when stdin is not used 2021-10-23 13:04:24 +02:00
Diva M ce4ddc0911 use saturating substraction to calculate Line ranges 2021-10-17 21:21:23 +02:00
Marcin Puc 7956485e37 Improve iterator usage 2021-09-12 15:50:10 +02:00
Martin Nordholts ed09f90e5e Fix all lints that are new with Rust 1.54
They are all of the following type:
https://rust-lang.github.io/rust-clippy/master/index.html#needless_borrow
2021-08-19 07:19:12 +02:00
Niklas Mohrin 694b31909a Change circle detection to use new more conservative method and run in main loop instead of before the loop 2021-02-28 23:04:49 +01:00
Niklas Mohrin 21ae26cb17 Add cycle detection with clircle, now v0.2 2021-01-05 18:21:16 +01:00
Lovecraftian Horror b349155f2f Remove repeated `contains` calls 2020-12-21 09:41:29 +01:00
sharkdp a6810e3353 Revert "Add io cycle detection with clircle"
This reverts commit aa2ae19dfd.
2020-11-24 21:40:11 +01:00
MarcoIeni 43b2ee5e71 fix some clippy warnings 2020-11-23 14:25:01 +01:00
Niklas Mohrin 31793cfa62 Add io cycle detection with clircle 2020-11-23 14:06:54 +01:00
gahag bbef2f41ec Add `-S` flag to less when `--wrap=never` (closes #1255)
Prevent less from wrapping lines by setting the proper flag when `--wrap=never`.
If the user set a custom value for `--pager`, no additional flag is set.
2020-10-08 18:51:42 +02:00
Evgeniy Andreev (gsomix) 3c5ce9f86c Enable non-printable chars for redirected output (#1061) 2020-07-02 09:36:58 +04:00
Ethan P 35b6067496 Print error message when invalid syntax is specified 2020-05-16 13:44:26 +02:00
Prat T 0040fef215 Add padding above headers when no grid 2020-05-12 16:37:29 +02:00
sharkdp 48a7ce3bf2 Write error messages to pager, if attached
closes #946
2020-04-25 13:08:00 +02:00
sharkdp 5fe8a8342b Add annotations again 2020-04-24 16:51:11 +02:00
sharkdp 23afc8e90c Skip non-file inputs when using --diff 2020-04-24 16:12:38 +02:00
Lzu Tao e37e9c1214 Fix some clippy lints
Some might actually improve perf
2020-04-24 16:11:05 +02:00
sharkdp 82e7786e74 Implementation of 'bat --diff'
This adds a new `--diff` option that can be used to only show lines
close to Git changes (added/removed/modified lines). The amount of
additional context can be controlled with `--diff-context=N`.

closes #23
2020-04-24 09:57:57 +02:00
sharkdp 8961f7aef8 Move PagingMode to separate module 2020-04-22 23:55:28 +02:00
sharkdp 12eee0c590 Fix warnings for --no-default-features mode 2020-04-22 23:55:28 +02:00
sharkdp 702cb198da Rename error module 2020-04-22 23:55:28 +02:00
sharkdp 26c951fec4 Fix warnings, sort imports, input from string 2020-04-22 23:55:28 +02:00
sharkdp 590960f7f5 Completely refactor 'input' module 2020-04-22 23:55:28 +02:00
sharkdp f3b90ddb38 Add InputDescription 2020-04-22 23:55:28 +02:00
sharkdp f8d0956893 Rename InputFile => Input 2020-04-22 23:55:28 +02:00
sharkdp 1dc328ad49 Separate inputs from config 2020-04-22 23:55:28 +02:00
sharkdp 057e4eced1 Large refactoring towards a better builder structure 2020-04-22 23:55:28 +02:00
sharkdp 34619a2e89 Small refactoring, handle invalid UTF-8 filenames 2020-04-21 08:57:15 +02:00
sharkdp 1b8ce60054 Pass stdin as a generic BufRead, fix stdin tests 2020-04-21 08:57:15 +02:00
Kyle Criddle 04fa84aea7 Moved user_provided_filename to be contained within OrdinaryFile struct 2020-04-21 08:57:15 +02:00
Kyle Criddle a3f8140fbe Use --file-name to detect syntax highlighting
Closes #891
2020-04-21 08:57:15 +02:00
David Tolnay 42e3825daf Updates for review of PR 899 2020-03-31 09:27:56 +02:00
Kyle Criddle 83772bd2cf Minor --file-name code hygeine 2020-03-25 18:58:05 -06:00
Kyle Criddle 38178fedf4 Merge branch 'master' into fix_654_stdin_filename 2020-03-24 19:08:43 -06:00
Kyle Criddle 59f2e2d58d Implemented --file-name for multiple files + tests 2020-03-24 18:26:00 -06:00
sharkdp 84ba323b1c Rename output component to 'style compinent', move wrap to separate module 2020-03-21 22:21:23 +01:00
sharkdp fc1ca0875a Move error handling to a callback 2020-03-21 22:21:23 +01:00
sharkdp a7338e2ea2 Run cargo fmt 2020-03-21 22:21:23 +01:00
sharkdp 9b8ddb24d1 move Config struct to separate file 2020-03-21 22:21:23 +01:00
sharkdp 4855a47105 Rename enum field 2020-03-21 19:19:15 +01:00