/* Hurry Curry! - a game about cooking Copyright (C) 2025 Hurry Curry! Contributors This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, version 3 of the License only. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ pub mod book_html; pub mod diagram_svg; use crate::book_html::render_html_book; use anyhow::Result; use clap::{Parser, ValueEnum}; use hurrycurry_data::{book::book, index::DataIndex}; use hurrycurry_locale::FALLBACK_LOCALE; #[derive(Parser)] struct Args { #[arg(short, long)] format: ExportFormat, #[arg(short, long, default_value = "5star")] map: String, } #[derive(ValueEnum, Clone, Copy)] enum ExportFormat { Json, Html, } fn main() -> Result<()> { env_logger::init_from_env("LOG"); let args = Args::parse(); let index = DataIndex::new("data".into())?; let (data, serverdata) = index.generate(&args.map)?; let book = book(&data, &serverdata)?; match args.format { ExportFormat::Json => { println!("{}", serde_json::to_string(&book).unwrap()) } ExportFormat::Html => { println!("{}", render_html_book(&data, &book, &FALLBACK_LOCALE)); } } Ok(()) }