mirror of
https://github.com/sharkdp/bat.git
synced 2025-09-08 14:22:25 +01:00
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.
This commit is contained in:
@@ -55,6 +55,9 @@ pub(crate) const COMPRESS_THEMES: bool = false;
|
||||
/// performance due to lazy-loading
|
||||
pub(crate) const COMPRESS_LAZY_THEMES: bool = true;
|
||||
|
||||
/// Compress for size of ~10 kB instead of ~120 kB
|
||||
pub(crate) const COMPRESS_ACKNOWLEDGEMENTS: bool = true;
|
||||
|
||||
impl HighlightingAssets {
|
||||
fn new(serialized_syntax_set: SerializedSyntaxSet, theme_set: LazyThemeSet) -> Self {
|
||||
HighlightingAssets {
|
||||
@@ -305,6 +308,13 @@ pub(crate) fn get_integrated_themeset() -> LazyThemeSet {
|
||||
from_binary(include_bytes!("../assets/themes.bin"), COMPRESS_THEMES)
|
||||
}
|
||||
|
||||
pub fn get_acknowledgements() -> String {
|
||||
from_binary(
|
||||
include_bytes!("../assets/acknowledgements.bin"),
|
||||
COMPRESS_ACKNOWLEDGEMENTS,
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn from_binary<T: serde::de::DeserializeOwned>(v: &[u8], compressed: bool) -> T {
|
||||
asset_from_contents(v, "n/a", compressed)
|
||||
.expect("data integrated in binary is never faulty, but make sure `compressed` is in sync!")
|
||||
|
Reference in New Issue
Block a user