extern crate wiserone;
use serde_json::to_string_pretty;
use std::error::Error;
use wiserone::html::generate_html_file;
use wiserone::quotes::read_quotes_from_file;
fn main() -> Result<(), Box<dyn Error>> {
println!("Reading and parsing quotes from a JSON file:");
let mut quotes = read_quotes_from_file("./quotes/01-quotes.json")?;
let json_string = to_string_pretty("es).unwrap();
println!("Quotes:\n{}\n", json_string);
println!("Selecting a random quote:");
let random_quote = quotes.select_random_quote()?;
let json_string = to_string_pretty(&random_quote).unwrap();
println!("Random Quote: {}\n", json_string);
println!("Generating an HTML file for the random quote:");
let filename = "../examples/example_quote.html";
generate_html_file(filename, random_quote)?;
println!("Generated HTML file: {}\n", filename);
Ok(())
}