1
0
mirror of https://github.com/sharkdp/bat synced 2026-08-04 19:01:44 +00:00

Make 'build-assets' an optional capability for application

Also structure features a bit more clever to avoid duplication of
feature dependency declarations.
This commit is contained in:
Martin Nordholts
2021-08-10 22:18:47 +02:00
parent deddc81426
commit 25fa577cd0
8 changed files with 45 additions and 44 deletions
+2
View File
@@ -16,6 +16,7 @@ pub struct AssetsMetadata {
const FILENAME: &str = "metadata.yaml";
impl AssetsMetadata {
#[cfg(feature = "build-assets")]
pub(crate) fn new(current_version: &str) -> AssetsMetadata {
AssetsMetadata {
bat_version: Some(current_version.to_owned()),
@@ -23,6 +24,7 @@ impl AssetsMetadata {
}
}
#[cfg(feature = "build-assets")]
pub(crate) fn save_to_folder(&self, path: &Path) -> Result<()> {
let file = File::create(path.join(FILENAME))?;
serde_yaml::to_writer(file, self)?;