Commit Graph

47 Commits (master)

Author SHA1 Message Date
Ethan P 0e4e10edb6
Add --squeeze-limit to specify max number of consecutive empty lines
Co-authored-by: einfachIrgendwer0815 <85333734+einfachIrgendwer0815@users.noreply.github.com>
3 months ago
Ethan P 0c7e5299bf
Add squeeze_empty_lines to PrettyPrinter 3 months ago
Peter Hebden 103a2f0d9b Add `OutputHandle` enum to use instead of `&mut dyn io::Write` 9 months ago
Collin Styles 7929179a74 Make `PrettyPrinter::header` an alias for `header_filename`
Fixes #2378
1 year ago
rhysd 4cc2a489d0 Remove unnecessary heap allocations in `PrettyPrinter::print` for style components 1 year ago
rhysd 3d7817d662 Clear `highlighted_lines` when calling `PrettyPrinter::print` 2 years ago
rhysd abd69f2deb Add `bat::PrettyPrinter::clear_highlights` (fixes #1919) 2 years ago
Martin Nordholts 49875d6ce7
Make `bat::PrettyPrinter::syntaxes()` iterate over new `bat::Syntax` struct (#2222)
We can't keep `syntect::parsing::SyntaxReference` as part of the public
API, because that might prevent us from bumping to syntect 6.0.0 without
also bumping bat to v2.0.0, once we reach v1.0.0.

So introduce a new stripped down struct `Syntax` and return that
instead. Let it be fully owned to make the API simple. It is not going
to be in a hot code path anyway.

I have looked at all code of our 27 dependents but I can't find a single
instance of this method being used, so this change should be safe for
v1.0.0.
2 years ago
acheronfail b1e67e215c Allow configuring show_nonprintable from PrettyPrinter 2 years ago
Martin Nordholts a81009607a HighlightingAssets: Make .syntaxes() and syntax_for_file_name() failable
Or rather, introduce new versions of these methods and deprecate the old ones.

This is preparation to enable robust and user-friendly support for lazy-loading.
With lazy-loading, we don't know if the SyntaxSet is valid until after we try to
use it, so wherever we try to use it, we need to return a Result. See discussion
about panics in #1747.
3 years ago
Martin Nordholts 073b9968c0 pretty_printer.rs: Don't use a URL as an example Input title
Otherwise Rust 1.53.0 gets confused during `cargo doc` because it thinks
we want an actual URL:

    warning: this URL is not a hyperlink
    --> src/pretty_printer.rs:331:40
        |
    331 |     /// The title for the input (e.g. "http://example.com/example.txt")
        |                                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use an automatic link instead: `<http://example.com/example.txt>`
        |
        = note: `#[warn(rustdoc::bare_urls)]` on by default
        = note: bare URLs are not automatically turned into clickable links

It was perhaps also a bit confusing to give an URL as an example in the
first place, because according to our own API example
`examples/inputs.rs` it is meant to be more a free-text thing.
3 years ago
Mohamed Abdelnour a27814db8e Implement `From<..>` instead of `Into<..>` 3 years ago
Mohamed Abdelnour 9702f5256c Use the functional update syntax 3 years ago
Aleksey Kladov 35347c2310 Improve readability
Using `Path`s for paths expresses intent more clearly.
3 years ago
sharkdp 060b9981b5 Remove deprecated PrettyPrinter methods 3 years ago
sharkdp 09fbabb0b8 Add a Default implementation for PrettyPrinter 3 years ago
MarcoIeni 43b2ee5e71 fix some clippy warnings 4 years ago
Tom Milligan aa4000cb0d
style: add component 'rule' for horizontal file delimiter 4 years ago
Ethan P 342cae2dc6 Change use of 'BatInput' to 'input::Input' 4 years ago
Ethan P a8d7141c4c Improve documentation for Input API 4 years ago
Ethan P 798b742617 Refactor InputDescription API into Input API 4 years ago
Ethan P 2f823d59b0 Add PrettyPrinter::input function 4 years ago
sharkdp 8f1babf346 Mark 'vcs_modification_markers' as deprecated 4 years ago
sharkdp fa25695b74 Make 'vcs_modification_markers' change non-breaking 4 years ago
Ethan P 887e61a99d
Allow application to be built without git support
Caveats:
The help descriptions aren't changed with you remove the "git" feature.
4 years ago
Ethan P 0aca8cab0b
Remove vcs_modification_markers from PrettyPrinter 'git' feature disabled 4 years ago
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
4 years ago
sharkdp 8961f7aef8 Move PagingMode to separate module 4 years ago
sharkdp 17f3a3b95d Simpler highlight method 4 years ago
sharkdp 261a7ea154 Add *_with_name methods 4 years ago
sharkdp 53a973e9dd Add syntaxes and themes method 4 years ago
sharkdp 702cb198da Rename error module 4 years ago
sharkdp 13f671b499 Update examples 4 years ago
sharkdp 6a124591df Easier configuration of style components 4 years ago
sharkdp 36dde9275a Simplify style_components 4 years ago
sharkdp f034be71e7 rename run => print 4 years ago
sharkdp ec0ce05455 Better API for highlighting lines 4 years ago
sharkdp 26c951fec4 Fix warnings, sort imports, input from string 4 years ago
sharkdp 590960f7f5 Completely refactor 'input' module 4 years ago
sharkdp b4d54106fe Fix comment 4 years ago
sharkdp f3b90ddb38 Add InputDescription 4 years ago
sharkdp 3bacfc5184 Allow fluent style 4 years ago
sharkdp f8d0956893 Rename InputFile => Input 4 years ago
sharkdp 1dc328ad49 Separate inputs from config 4 years ago
sharkdp 5e5cb89da6 Add all builder options 4 years ago
sharkdp 057e4eced1 Large refactoring towards a better builder structure 4 years ago
sharkdp 27974616bf Initial verison of PrettyPrinter builder 4 years ago