diff --git a/src/commands/generate.rs b/src/commands/generate.rs index d70130c..2439afb 100644 --- a/src/commands/generate.rs +++ b/src/commands/generate.rs @@ -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)] @@ -22,6 +27,19 @@ struct Metadata { authors: Option>, } +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, @@ -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()?; }