Commit Graph

842 Commits (d24501ab5efd5ddd40a7597615cea521aed1eb0e)

Author SHA1 Message Date
cyqsimon 14ddda0a8b
Recognize files in `$XDG_CONFIG_HOME/git/` and `$HOME/.config/git/` better (#2067)
* git global config - lookup $XDG_CONFIG_HOME faithfully

* Use `bool::then`

* Cover both `$XDG_CONFIG_HOME` & `$HOME/.config`

* Remove unused import

* Global git config tests

* Added trailing newline

* Fix git config test

* Wrote to changelog

* Revert change of `Result::ok` to `Result::unwrap`

* Apply suggestions from code review

Co-authored-by: Martin Nordholts <enselic@gmail.com>

* Guard against empty `$HOME`

Co-authored-by: Martin Nordholts <enselic@gmail.com>
3 years ago
Mahdi Dibaiee d21f1e8f17
Underline highlighted lines in ANSI theme (#1985)
* Underline highlighted lines in ANSI theme

* add test for ansi highlight underline, fix underscore in plain
3 years ago
Dan Davison 4e36a56014
Expose syntect theme and syntax sets (#2030)
Fixes #2026
Ref https://github.com/dandavison/delta/issues/895
3 years ago
Mahdi Dibaiee 312c8ef01f
Add new `--style` called `header-filesize` and display it by default (#1988)
Also rename `header` to `header-filename`.

Related to #1701
3 years ago
Martin Nordholts 486510395b Allow the license used by GraphQL
This license is apparently common enough that GitHub recognizes it. See
https://github.com/dncrews/GraphQL-SublimeText3/blob/master/LICENSE.

This will fix the CI failure in #2000
3 years ago
Martin Nordholts 5b37438f08 `bat --help`: Put `--ignored-suffix` directly after `--map-syntax`
It feels out of place to have between `--acknowledgements` and `--help`.
3 years ago
Martin Nordholts 68528983d7 Mark `MappingTarget` as `#[non_exhaustive]` for increased semver flexibility
This will allow us to add new enum variants in the future without breaking
semver compatibility. See
https://doc.rust-lang.org/reference/attributes/type_system.html#the-non_exhaustive-attribute

Since we already added an enum variant since v0.18.3, now is a good time to mark
it as `#[non_exhaustive]`.
3 years ago
Martin Nordholts a3ea798246
Credit syntax definition and theme authors with new `--acknowledgements` option (#1971)
The text that is printed is generated when building assets, by analyzing LICENSE
and NOTICE files that comes with syntaxes and themes.

We take this opportunity to also add a NOTICE file as defined by Apache License 2.0.
3 years ago
Ethan P 63ad53817d
Improved ANSI passthrough (#1596)
Improve handling of ANSI passthrough. Fix ANSI passthrough for --wrap=never. Add test for ANSI passthrough.
3 years ago
Martin Nordholts e250da8aaa Run `cargo clippy --fix --all-targets --all-features` with Rust 1.57
Clippy in the newly released Rust 1.57 found some new lints. Conveniently, all
of them were fixable with `--fix`.
3 years ago
Martin Nordholts 7fceb4878f
Load themes lazily for improved startup time (#1969)
This is for #951. Syntax lazy-loading will come later and have a much bigger
impact, but lazy-loading of themes does not have negligible impact.
3 years ago
Bojan Durdevic b8e79a2160 Line range edge cases test 3 years ago
Bojan Durdevic 715b0d8bf5 Line range minus overflow prevention 3 years ago
Bojan Durdevic 0eb4aaac1e Line range minus syntax clippy suggestions addressed 3 years ago
Bojan Durdevic bc86c29185 Support for line range minus syntax 3 years ago
Martin Nordholts 5519f9c716 Use once_cell instead of lazy_static
once_cell can do what lazy_static does and more, so replace lazy_static with
once_cell.

See https://docs.rs/once_cell/1.8.0/once_cell/#general-purpose-lazy-evaluation
3 years ago
Martin Nordholts dd0925a946 Replace lazycell with once_cell
We started to use lazycell because syntect already used it. But syntect has
changed to use once_cell. So we should also do that to prepare for using the
upcoming version of syntect.
3 years ago
Martin Nordholts d7671fa8e3 Remove the code related to minimal_syntaxes.bin
To get fast startup, syntect will instead start to lazy-load syntaxes. See
https://github.com/trishume/syntect/pull/393 and discussions in linked PRs.
3 years ago
Martin Nordholts e79b07bf5e HighlightingAssets::get_syntax_set(): Make private
Was forgotten in aefc8fd824.
3 years ago
Bojan Đurđević d6ed5e6746
Support for ignored-suffix CLI arguments (#1892) 3 years ago
rhysd d5f737f402 show skip message when asset cache is not found 3 years ago
cbolgiano 7fe4fdf33d
Introduce MapExtensionToUnknown MappingTarget (#1889)
Co-authored-by: Martin Nordholts <enselic@gmail.com>
3 years ago
Martin Nordholts 4081ace4b9 Include git hash in `bat -V` and `bat --version` output if present
I had to use a `lazy_static` due to that the clap API that only accepts a
reference to a version string. And, in our code, only a 'static reference to a
version string.

Code could probably be refactored to accept a "normal" reference, but that would
be a major undertaking.
3 years ago
rhysd f28d9db3d0 use io::Empty instead of crafted dummy stdin struct 3 years ago
rhysd deb80af449 remove unused lifetime parameter 3 years ago
rhysd dc0acbbb90 inline a closure which is called only once 3 years ago
rhysd 92ba42a602 do not take stdin lock when stdin is not used 3 years ago
rhysd ed3246c423 Make grep-cli optional dependency 3 years ago
Diva M ce4ddc0911 use saturating substraction to calculate Line ranges 3 years ago
Martin Nordholts 554374667e Deny unsafe code in lib and bin
The deny also applies recursively to submodules.
3 years ago
Martin Nordholts aefc8fd824 src/printer.rs: Simplify Plain Text fallback code
By forwarding the task to find the `Plain Text` syntax to `assets`. Not only does
the code become simpler; we also get rid of a call to `self.get_syntax_set()`
which is beneficial to the long term goal of replacing `syntaxes.bin` with
`minimal_syntaxes.bin`.

Note that the use of `.expect()` is not a regression in error handling. It was
previously hidden in `.find_syntax_plain_text()`.
3 years ago
Martin Nordholts 405a80f3ee HighlightingAssets: Turn get_syntax_for_path() into public API 3 years ago
Martin Nordholts ad98d35a48 HighlightingAssets: Implement get_syntax_for_file_name() with get_syntax_for_path()
We can do this since the file_name() of a file_name is file_name.
3 years ago
Martin Nordholts b69ab219d7 HighlightingAssets: Extract get_syntax_for_path() method
To make the code easier to refactor further.
3 years ago
Martin Nordholts dc8225f682 src/assets.rs: Extract helper method OpenedInput::path() 3 years ago
Martin Nordholts 9d9b266f54 build_assets.rs: Enable dump of syntax dependencies to Graphviz dot file 3 years ago
Martin Nordholts b9d01c1a61 build_assets.rs: Ignore explicit contexts when tracking dependencies 3 years ago
Martin Nordholts 122cae7902 build_assets.rs: Sort first to make dependencies.dedup() actually useful 3 years ago
Martin Nordholts 5143f3ad43 build_assets.rs: Add code to track dependents of each syntax
This information is useful when you want to build several SyntaxSets, but
without having to duplicate SyntaxDefinitions. For example:

"Rust" has no dependencies. But "Markdown" depends on "Rust". With the data
structures this code adds, we know that "Rust" is a dependent syntax for
"Markdown", and can construct a SyntaxSet that takes that into account.

Note that code has a temporary environment flag to ignore any information about
dependents when constructing SyntaxSets. Code that makes use of the new data
structure will be added later.
3 years ago
Martin Nordholts a6dc25a216 build_assets.rs: Make OtherSyntaxLookup come before SyntaxToDependencies
It makes more sense structurally when we later introduce SyntaxToDependents.
3 years ago
Martin Nordholts f04d2a9d6a build_assets.rs: Rename 'Dependency' to 'OtherSyntax'
So that we later can use it for not only information about dependencies, but
also for information about dependents.
3 years ago
Martin Nordholts eb3b3b9f8d src/printer.rs: Add HighlighterFromSet helper
The main benefit is that we get rid of a call to `assets.get_syntax_set()`,
which in turn makes it easier to later get rid of `syntaxes.bin`.
3 years ago
Martin Nordholts 0994f3783f HighlightingAssets: Move common get_extension_syntax() code into find_syntax_by_extension() 3 years ago
Martin Nordholts 974dec38e3 HighlightingAssets: Inline find_syntax_by_file_name() and find_syntax_by_file_name_extension()
There is no benefit to keeping separate functions.
3 years ago
Martin Nordholts a0c363647f src/assets.rs: Use /// not // for COMPRESS_* consts 3 years ago
Martin Nordholts d989224a8a HighlightingAssets: Inline absolute_path
Its name is confusing, because it does not always hold an absolute path. Get rid
of this problem by inlining it.
3 years ago
Martin Nordholts 82f439e715 HighlightingAssets: Simplify absolute_path with .map_or_else() 3 years ago
Martin Nordholts b034879eae HighlightingAssets: No need for both path and path_str 3 years ago
Martin Nordholts 9ed9a6fc3d
Simplify HighlightingAssets::get_syntax() first_line logic (#1852)
And make self.get_first_line_syntax() be called lazily.
3 years ago
Martin Nordholts e84b702309
Extract some private submodules from 'bat::assets' (#1850) 3 years ago
Martin Nordholts 6226eba52a HighlightingAssets: Add find_syntax_by_extension() helper 3 years ago
Martin Nordholts 9e0ea06435 HighlightingAssets: Add find_syntax_by_name() helper 3 years ago
Marcin Puc 863d9cacd0 Add various other code refactorings 3 years ago
Marcin Puc 4baa346aae Use deref coercion to simplify some argument passing 3 years ago
Marcin Puc 7956485e37 Improve iterator usage 3 years ago
Marcin Puc 372e42f350 Reduce nesting in if blocks by short circuiting 3 years ago
Martin Nordholts 9124271eaf
Load independent and minimal syntax sets when using --language (#1787)
This significantly speeds up the startup time of bat, since only a single
linked SyntaxDefinition is loaded for each file. The size increase of the
binary is just ~400 kB.

In order for startup time to be improved, the --language arg must be used, and
it must match one of the following names:

"Plain Text", "ActionScript", "AppleScript", "Batch File", "NAnt Build File",
"C#", "C", "CSS", "D", "Diff", "Erlang", "Go", "Haskell", "JSON", "Java
Properties", "BibTeX", "LaTeX Log", "TeX", "Lisp", "Lua", "MATLAB", "Pascal",
"R", "Regular Expression", "Rust", "SQL", "Scala", "Tcl", "XML", "YAML", "Apache
Conf", "ARM Assembly", "Assembly (x86_64)", "CMakeCache", "Comma Separated
Values", "Cabal", "CoffeeScript", "CpuInfo", "Dart Analysis Output", "Dart",
"Dockerfile", "DotENV", "F#", "Friendly Interactive Shell (fish)", "Fortran
(Fixed Form)", "Fortran (Modern)", "Fortran Namelist", "fstab", "GLSL",
"GraphQL", "Groff/troff", "group", "hosts", "INI", "Jinja2", "jsonnet",
"Kotlin", "Less", "LLVM", "Lean", "MemInfo", "Nim", "Ninja", "Nix", "passwd",
"PowerShell", "Protocol Buffer (TEXT)", "Puppet", "Rego", "resolv", "Robot
Framework", "SML", "Strace", "Stylus", "Solidity", "Vyper", "Swift",
"SystemVerilog", "TOML", "Terraform", "TypeScript", "TypeScriptReact",
"Verilog", "VimL", "Zig", "gnuplot", "log", "requirements.txt", "Highlight
non-printables", "Private Key", "varlink"

Later commits will improve startup time for more code paths.

* fix some typos and misspellings

* CHANGELOG.md: Add Performance section (preliminary)

* Add a CHANGELOG.md entry for this PR
3 years ago
Kevin John Mulligan 156dec2737 Add context to .ino configuration
This allows a user to search the README or the entire repository for "Arduino" to find the necessary configuration.
3 years ago
Martin Nordholts 87978e7755
Make asset compression optional at compile time (#1825)
This will be needed to later support zero-copy deserialization of independent
syntax sets, but is interesting and useful on its own.

Instead of deferring serialization and deserialization to syntect, we implement it
ourselves in the same way, but make compression optional.
3 years ago
Ville Skyttä 7c41bd72da assets: add Debian ucf backups to ignored suffixes
Refs https://manpages.debian.org/bullseye/ucf/ucf.1.en.html
3 years ago
Martin Nordholts 27fa55d274
src/build_assets.rs: Refactor into smaller functions (#1822)
To make the code easier to work with.
3 years ago
Martin Nordholts 19c3e82abf
Replace deprecated 'error-chain' with 'thiserror' (#1820)
We can't use #[from] on Error::Msg(String) because String does not implement Error.
(Which it shouldn't; see e.g. https://internals.rust-lang.org/t/impl-error-for-string/8881.)
So we implement From manually for Error::Msg, since our current code was written
in that way for error-chain.
3 years ago
Martin Nordholts f1c0fd7343
Don't take a HighlightingAssets detour to build assets (#1802)
Move code to build assets to its own file. That results in better modularity and flexibility.

It also allows us to simplify HighlightingAssets a lot, since it will now always
be initialized with a SerializedSyntaxSet.
3 years ago
Bojan Durdevic c86a179412 PR comments addressed for line range +delta syntax 3 years ago
Bojan Durdevic 0748783404 Support for line range plus syntax 3 years ago
Martin Nordholts ba8a694314 Add LANG and LC_ALL to --diagnostics output
To make it easier to debug problems like #1806 in the future.
3 years ago
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
3 years ago
Martin Nordholts f5c1cb2dff Run 'cargo fmt' 3 years ago
Martin Nordholts 25fa577cd0 Make 'build-assets' an optional capability for application
Also structure features a bit more clever to avoid duplication of
feature dependency declarations.
3 years ago
Martin Nordholts deddc81426 src/assets.rs: Use ThemeSet::new() instead of BTreeMap::new() 3 years ago
Bill Risher bf78288e9e feat(config): added recognition of $BAT_CONFIG_DIR 3 years ago
Martin Nordholts 89217e0d58 Make --no-paging and --no-pager work again 3 years ago
Martin Nordholts 905902d811 bin: Allow to build without bugreport 3 years ago
Martin Nordholts d8b813c0bf
When returning a SyntaxReference, also return the SyntaxSet that contains it (#1776)
To improve startup performance, we will later load smaller `SyntaxSet`s instead
of one giant one. However, the current API assumes only one `SyntaxSet` is ever used,
and that that implicitly is the `SyntaxSet` from which returned `SyntaxReference`s
comes.

This change changes the API to reflect that `SyntaxSet` and `SyntaxReference`
are tightly coupled, and enables the use of several `SyntaxSet`.
3 years ago
Martin Nordholts 5236ed135e Fix typo in unreachable!(..) message for --wrap 3 years ago
Martin Nordholts 47d955a2ab Add code for analyzing dependencies between syntaxes
And also to generate independent SyntaxSets. This will later be used
to improve bat startup time.
3 years ago
Martin Nordholts 8ecd23eab4 Make --style docs reflect that 'full' is default
Closes #1742
3 years ago
Martin Nordholts 0331d28ee4 cargo fmt 3 years ago
Martin Nordholts 28eca6a2be Use assert!(..) instead of assert_eq!(true, ..)
This fixes all of these lint warnings:
https://rust-lang.github.io/rust-clippy/master/index.html#bool_assert_comparison

They only appear in recent versions of clippy. Not on our MSRV.
3 years ago
Keith Hall 3b020fd95a
Merge pull request #1771 from sharkdp/warn_when_missing_contexts
Warn when building assets from files if some referenced contexts are missing
3 years ago
Keith Hall 50e1c6074f Warn when building assets from files if some referenced contexts are missing 3 years ago
Martin Nordholts a610987ef7 assets::tests: Add get_syntax_name() helper
And instead of taking a get_syntax_set() detour to return a
name that represents "no syntax", return such a string directly.
3 years ago
Martin Nordholts ffdf349a96 HighlightingAssets: Encapsulate theme_set behind a getter
Mainly to prepare for potential lazy-loading in the future to
improve startup performance. Like we did for syntax_set.
3 years ago
Martin Nordholts 6acec2c074 Reduce startup time in loop-through mode with 80%-90%
Instead of 100 ms - 50 ms, startup takes 10 ms - 5 ms.

HighlightingAssets::get_syntax_set() is never called when e.g. piping the bat
output to a file (see Config::loop_through), so by loading the SyntaxSet only
when needed, we radically improve startup time when it is not needed.
3 years ago
Martin Nordholts 1bac3750df HighlightingAssets: Move out fn get_integrated_*set() to module scope
They are just a way to get access to data embedded in the binary, so they don't
conceptually belong inside HighlightingAssets.

This has the nice side effect of getting HighlightingAssets::from_cache() and
::from_binary(), that are highly related, next to each other.
3 years ago
Martin Nordholts b040efff79 Support a hidden arg --no-custom-assets that skips loading assets from the cache 3 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 c0e09662b4 HighlightingAssets::get_extension_syntax(): Split up into smaller methods
To make the code easier to understand and change.
3 years ago
Martin Nordholts ccf4563573 Make loading of cached assets closer in performance to integrated assets
Using BufReader makes sense for large files, but assets are never large enough
to require buffering. It is significantly faster to load the file contents in
one go, so let's do that instead.

Closes #1753
3 years ago
Martin Nordholts f6fc826dc6 HighlightingAssets: Introduce private fn new() helper
It already now reduces code duplication slightly, but will become even more
useful in the future when we add more complicated logic such as lazy-loading.
3 years ago
Martin Nordholts 375d55aa5d HighlightingAssets: Encapsulate syntax_set behind a getter
Since we only modify `pub(crate)` items, the stable bat-as-a-library API is not
affected.

This takes us one step closer to making SyntaxSet lazy-loaded, which in turn
takes us one step closer to solving #951.
3 years ago
Martin Nordholts 6ef2bb3283 De-duplicate some themes.bin and syntaxes.bin related code 3 years ago
David Peter 33c11d64f0 Run cargo fmt 3 years ago
David Peter 3fa09dbe2e Use resolved path for --diagnostic as well 3 years ago
David Peter bf2b2df9c9 Fix for Windows: do not run binaries from CWD
This fixes a bug on Windows where `Command::new` would also run
executables from the current working directory, possibly resulting in
accidental runs of programs called `less`.
3 years ago
David Peter 21338ed789 Abort ignored filename suffix stripping early on unworkable filenames 3 years ago
David Peter dc8ab0b5ce Simplify ignored filename suffix stripping 3 years ago
Ville Skyttä 355e62efe9 Find syntax ignoring known backup/template filename suffixes
For example, fall back to `foo.extension` for `foo.extension~`,
`foo.extension.orig`, `foo.extension.in.in` etc.
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
Ville Skyttä 90e48e9b61 Spelling fixes 3 years ago
Mohamed Abdelnour aa74d19940 Refactor "Use `matches` macro" 3 years ago
Mohamed Abdelnour 425a0f90e9 Use the functional update syntax 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
Mohamed Abdelnour 23fd11e806 Use `matches` macro 3 years ago
Mohamed Abdelnour 304ee1489c Use `!theme.is_empty()` 3 years ago
Allen Wild 91a347bf6d Fix less version parsing for minor versions of less
Less 581.2 is here, and it has a ".2" in the version string, which can't
be parsed as a usize.

Update the check to find a non-digit character rather than a space. This
ignores the minor version, but parses the major version correctly.
3 years ago
Martin Nordholts e04fbd1992 Include LESS in --diagnostic
So issues like #1586 are easier to troubleshoot.
4 years ago
Sean McLoughlin d89fa3ebc2 Add SystemVerilog support 4 years ago
David Peter 2e7f2b6c07 'mut self' => 'self', remove pub 4 years ago
Aleksey Kladov 35347c2310 Improve readability
Using `Path`s for paths expresses intent more clearly.
4 years ago
Niklas Mohrin 694b31909a Change circle detection to use new more conservative method and run in main loop instead of before the loop 4 years ago
David Peter ca60937c2e Do not ignore non-existent BAT_CONFIG_PATH
Do not ignore `BAT_CONFIG_PATH` if it doesn't exist. Both when
generating a new config file with `--generate-config-file` and
when attempting to read the config.

Also, provide a better error message in case the file can not
be created.

closes #1550
4 years ago
David Peter 94496df3b0 Fix broken resolv.conf highlighting
closes #1510

The change in `create_highlighted_versions.py` fixes a "unknown theme
"'1337'" warning. The single quotes were wrong. `bat` was always falling
back to the default theme, so let's use that for now.
4 years ago
David Peter 7eabb5e05a Highlight *.pac files as JavaScript
closes #1515
4 years ago
David Peter 9ad401be87 Fix clippy suggestion 4 years ago
Ethan P f874c8e4db Use less binary specified in bat config for --diagnostic 4 years ago
Ethan P 025c5c061b Make less version check accept a path to the less binary 4 years ago
Caden Haustein 573f34d757
Update dependencies; replace unmaintained (#1522)
* Update dependencies; replace unmaintained

* Fix errors

* Revert dependency changes

* Revert git2 to 0.13.15

Co-authored-by: David Peter <mail@david-peter.de>
4 years ago
Martin Nordholts dc1620d1f0 get_pager(): Simplify use_less_instead expression 4 years ago
Martin Nordholts dd0d44bbb3 Fix #1413 Can't use `bat` at all! (Error: Use of bat as a pager is disallowed...)
Fixed by implementing the proposal by sharkdp:

* Allow PAGER=bat, but ignore the setting in bat and simply default to
  less. Unless of course, BAT_PAGER or --pager is used to overwrite the
  value of PAGER.

* Disallow the usage of bat within BAT_PAGER and --pager.
4 years ago
sharkdp 060b9981b5 Remove deprecated PrettyPrinter methods 4 years ago
sharkdp 1ae16fca90 Improve --map-syntax documentation, see #1386 4 years ago
Martin Nordholts 7809008016 PagerKind::from(): Simplify 4 years ago
Martin Nordholts dd6f57e107 pager.rs: Some comment fixups 4 years ago
Martin Nordholts dfe7a60140 PagerSource: [Bat]PagerEnvVar -> EnvVar[Bat]Pager 4 years ago
Martin Nordholts fc30277cfa pager.rs: Limit visibilities to pub(crate) 4 years ago
Martin Nordholts 02e6ff4183 Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
sharkdp c5c28eb05b --diagnostic: add MANPAGER environment variable 4 years ago
sharkdp cd7be018fe Fix clippy suggestion: .or_else(|| Some(…)) => .or(Some(…)) 4 years ago
sharkdp 03a2710a08 Use new matches!(…) macro to simplify code 4 years ago
sharkdp 09fbabb0b8 Add a Default implementation for PrettyPrinter 4 years ago
mark chaitin de6cb75f4b Addressed PR feedback. Upped min version and used matches! macro 4 years ago
mark chaitin 83c9cb7907 fix bug where long lines were truncated in plain mode without wrap=never not being set 4 years ago
Csaba Henk fed30b1b36 Fix theme dir hint in --list-themes output 4 years ago
Martin Nordholts da10166625 Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
sharkdp 26136be903 Add --diagnostics alias 4 years ago
sharkdp 6a52f69b58 Update to bugreport 0.3.0 4 years ago
sharkdp 60406c7c2d Exhaustive list of relevant environment variables 4 years ago
sharkdp dec94b4111 Add config file, compile time info and less version 4 years ago
sharkdp ebb97e94a9 Add --diagnostic option to bat 4 years ago
Martin Nordholts 46487b201f Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
Niklas Mohrin 21ae26cb17 Add cycle detection with clircle, now v0.2 4 years ago
Martin Nordholts bfa5342331 Also replace 'more' from PAGER with 'less'
But first do some quite significant refactorings to keep the code clean
and easy to understand.
4 years ago
Martin Nordholts 22bdc7c20f When PAGER=most, don't print a warning to stderr, silently use less instead 4 years ago
Martin Nordholts 552545fe5f Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
Martin Nordholts dcfe883f4b Simplify and polish pager.rs and related code 4 years ago
Martin Nordholts 05e9da390f bat cache --build: Print syntect error message for themes if any
This will fix #614 by making it clear what is wrong by showing the
following error message:

    Failed to load one or more themes from
    '/Users/me/.config/bat/themes' (reason: 'Invalid syntax theme
    settings')

We also need to add a check if theme_dir.exists(), otherwise an absent
dir will seem like an error:

    Failed to load one or more themes from
    '/Users/me/.config/bat/themes' (reason: 'IO error for
    operation on /Users/me/.config/bat/themes: No such file or
    directory (os error 2)')

(This is the same check we already have for syntax_dir.)
4 years ago
Martin Nordholts cc0f8ca813 Merge remote-tracking branch 'origin/master' into fix-1063 4 years ago
Martin Nordholts 9c16571347 bat --list-languages: remove unnecessary format!() call
To trigger/verify the changed code, run

    bat --list-languages   # or -L

This is the last clippy warning in the code that you get if you run

    cargo clippy --all-targets --all-features -- --allow clippy::style

so by fixing it it becomes easier to spot when a new warning is
introduced (that does not belong to the clippy category clippy::style).
And by making it easy to spot new warnings, we increase chance of such
regressions not ending up in the code base.
4 years ago