Skip to content

Commit

Permalink
feat: ✨ Display some metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
AntwortEinesLebens committed Jan 12, 2025
1 parent c649bf4 commit d8b7e49
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/commands/generate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
use crate::commands::{traces::Traces, Runnable};
use clap::Parser;
use serde::Deserialize;
use std::{error::Error, fs::read_to_string, path::PathBuf};
use std::{
error::Error,
fmt::{Display, Formatter, Result as FormatResult},
fs::read_to_string,
path::PathBuf,
};
use toml::from_str;

#[derive(Deserialize)]
Expand All @@ -22,6 +27,19 @@ struct Metadata {
authors: Option<Vec<Author>>,
}

impl Display for Metadata {
fn fmt(&self, formatter: &mut Formatter) -> FormatResult {
write!(
formatter,
"Generation file metadata\n\
Name: {}\n\
Version: {}\n\
References: {:?}",
self.name, self.version, self.references
)
}
}

#[derive(Deserialize)]
struct Author {
name: String,
Expand All @@ -42,6 +60,8 @@ impl Runnable for Generate {

let configuration: Configuration = from_str(read_to_string(self.path.clone())?.as_str())?;

println!("{}", configuration.metadata);

for trace in configuration.traces {
trace.run()?;
}
Expand Down

0 comments on commit d8b7e49

Please sign in to comment.