diff options
-rw-r--r-- | server/tools/src/book.rs | 8 | ||||
-rw-r--r-- | server/tools/src/book_html.rs | 24 | ||||
-rw-r--r-- | server/tools/src/main.rs | 12 |
3 files changed, 40 insertions, 4 deletions
diff --git a/server/tools/src/book.rs b/server/tools/src/book.rs index 6c871274..b77525af 100644 --- a/server/tools/src/book.rs +++ b/server/tools/src/book.rs @@ -23,7 +23,7 @@ use hurrycurry_protocol::{ book::{Book, BookPage}, }; -pub fn book() -> Result<()> { +pub fn book() -> Result<Book> { let mut diagram = recipe_diagram(&["plate:cheese-leek-soup".to_owned()])?; diagram_layout(&mut diagram)?; @@ -35,7 +35,11 @@ pub fn book() -> Result<()> { diagram, }); - let book = Book { pages }; + Ok(Book { pages }) +} + +pub fn print_book() -> Result<()> { + let book = book()?; println!("{}", serde_json::to_string_pretty(&book).unwrap()); Ok(()) } diff --git a/server/tools/src/book_html.rs b/server/tools/src/book_html.rs new file mode 100644 index 00000000..370f6901 --- /dev/null +++ b/server/tools/src/book_html.rs @@ -0,0 +1,24 @@ +/* + 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 <https://www.gnu.org/licenses/>. + +*/ + +use anyhow::Result; +use hurrycurry_protocol::book::Book; + +pub fn render_html_book(book: Book) -> Result<()> { + Ok(()) +} diff --git a/server/tools/src/main.rs b/server/tools/src/main.rs index bb8fbde2..31da0388 100644 --- a/server/tools/src/main.rs +++ b/server/tools/src/main.rs @@ -17,12 +17,18 @@ */ pub mod book; +pub mod book_html; pub mod diagram_layout; pub mod graph; pub mod graph_summary; pub mod recipe_diagram; -use crate::{book::book, graph::graph, graph_summary::graph_summary}; +use crate::{ + book::{book, print_book}, + book_html::render_html_book, + graph::graph, + graph_summary::graph_summary, +}; use anyhow::Result; use clap::Parser; @@ -31,6 +37,7 @@ enum Action { Graph, GraphSummary, Book, + BookHtml, } fn main() -> Result<()> { @@ -39,7 +46,8 @@ fn main() -> Result<()> { match action { Action::Graph => graph()?, Action::GraphSummary => graph_summary()?, - Action::Book => book()?, + Action::Book => print_book()?, + Action::BookHtml => render_html_book(book()?)?, } Ok(()) |