Commit Graph

86 Commits

Author SHA1 Message Date
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.
2021-12-11 14:00:45 +01:00
cbolgiano 7fe4fdf33d
Introduce MapExtensionToUnknown MappingTarget (#1889)
Co-authored-by: Martin Nordholts <enselic@gmail.com>
2021-10-25 17:59:12 +02:00
rhysd ed3246c423 Make grep-cli optional dependency 2021-10-17 21:22:57 +02:00
Martin Nordholts 554374667e Deny unsafe code in lib and bin
The deny also applies recursively to submodules.
2021-10-04 08:08:33 +02:00
Martin Nordholts 405a80f3ee HighlightingAssets: Turn get_syntax_for_path() into public API 2021-09-28 07:26:20 +02:00
Marcin Puc 7956485e37 Improve iterator usage 2021-09-12 15:50:10 +02:00
Marcin Puc 372e42f350 Reduce nesting in if blocks by short circuiting 2021-09-12 15:50:10 +02:00
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.
2021-08-26 13:12:21 +02:00
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.
2021-08-24 07:58:03 +02:00
Martin Nordholts ba8a694314 Add LANG and LC_ALL to --diagnostics output
To make it easier to debug problems like #1806 in the future.
2021-08-22 18:31:39 +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
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.
2021-08-17 10:58:21 +02:00
Martin Nordholts 905902d811 bin: Allow to build without bugreport 2021-08-08 11:18:26 +02:00
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`.
2021-08-08 08:26:17 +02:00
Martin Nordholts b040efff79 Support a hidden arg --no-custom-assets that skips loading assets from the cache 2021-07-29 08:27:02 +02:00
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.
2021-07-29 08:26:18 +02:00
David Peter 3fa09dbe2e Use resolved path for --diagnostic as well 2021-07-12 23:17:30 +02:00
Martin Nordholts e04fbd1992 Include LESS in --diagnostic
So issues like #1586 are easier to troubleshoot.
2021-03-17 21:10:16 +01:00
Aleksey Kladov 35347c2310 Improve readability
Using `Path`s for paths expresses intent more clearly.
2021-03-07 14:59:10 +01:00
David Peter 9ad401be87 Fix clippy suggestion 2021-02-16 09:13:22 +01:00
Ethan P f874c8e4db Use less binary specified in bat config for --diagnostic 2021-02-16 09:11:27 +01:00
sharkdp c5c28eb05b --diagnostic: add MANPAGER environment variable 2021-01-09 21:56:17 +01:00
Csaba Henk fed30b1b36 Fix theme dir hint in --list-themes output 2021-01-08 20:10:45 +01:00
sharkdp 6a52f69b58 Update to bugreport 0.3.0 2021-01-06 22:53:51 +01:00
sharkdp 60406c7c2d Exhaustive list of relevant environment variables 2021-01-06 22:53:51 +01:00
sharkdp dec94b4111 Add config file, compile time info and less version 2021-01-06 22:53:51 +01:00
sharkdp ebb97e94a9 Add --diagnostic option to bat 2021-01-06 22:53:51 +01:00
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.
2020-12-28 20:28:24 +01:00
Stefan Kunkel bf96e6e642 make bat -L use plain style 2020-12-21 09:24:56 +01:00
Stefan Kunkel cffacad306 make bat -L use pager 2020-12-21 09:24:56 +01:00
rsteube 84b0702399 only print themes hint in interactive mode 2020-12-17 10:41:07 +01:00
Nicholas L 8e8131590c Use platform based path concatenation 2020-10-30 08:04:14 +01:00
Nicholas L 3acfe790b9 Add extra themes help to output 2020-10-30 08:04:14 +01:00
sharkdp f84aceec3d Fix unwrap error 2020-09-20 19:54:05 +02:00
Kienyew 83c7750656 Use unwrap 2020-09-20 12:14:21 +02:00
Kienyew c477e23fe9 Handle file extension conflicts in --list-languages 2020-09-20 12:14:21 +02:00
Kienyew 31fb7087f1 Revert to previous commit 2020-09-20 12:14:21 +02:00
Kienyew 52d6701f8f Fix undesired behavior 2020-09-20 12:14:21 +02:00
Kienyew f97634011e Handle file extension conflicts in --list-languages (#1076) 2020-09-20 12:14:21 +02:00
Alexander Karlis 6017989c4c removed printlns, updated Changelog, updated man 2020-09-14 11:24:14 +02:00
Alexander Karlis d349974089 updated PR based on comments 2020-09-14 11:24:14 +02:00
sharkdp 19aa878a08 Remove explicit type annotation 2020-06-03 19:44:41 +02:00
sharkdp 9f52012443 Prevent allocation of additional Strings 2020-06-03 19:44:41 +02:00
sharkdp e57e9b6dbb Use 'or_insert_with' 2020-06-03 19:44:41 +02:00
sharkdp ec2722d465 Use 'if let' instead of 'match' 2020-06-03 19:44:41 +02:00
Alex Novak 9e2ea5fdd4 Incorporating feedback 2020-06-03 19:44:41 +02:00
Alex Novak 48b4a6a906 Adds a little logic to main to get other mappings from config 2020-06-03 19:44:41 +02:00
Ethan P 9d08c0102e Replace Input::stdin_as_file with bat-application functions 2020-05-29 22:13:10 +02:00
Ethan P a3357547ea Remove unused with_name for theme preview file 2020-05-29 22:13:10 +02:00
Ethan P 589c94aa93 Fix regression with --list-themes and --language 2020-05-29 22:13:10 +02:00