diff --git a/Cargo.toml b/Cargo.toml index a79e6ec..a467453 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,6 +41,7 @@ fast_class = {path = "./crates/fast_class"} formatter = {path = "./crates/formatter"} weaponry = {path = "./crates/weaponry"} more_fields = {path = "./crates/more_fields"} +monsters = {path = "./crates/monsters"} anyhow = "1.0.103" toml = "1.1.3" diff --git a/crates/cli_parser/src/lib.rs b/crates/cli_parser/src/lib.rs index 1fd3ad2..ac7820d 100644 --- a/crates/cli_parser/src/lib.rs +++ b/crates/cli_parser/src/lib.rs @@ -8,7 +8,8 @@ use config::{ fast_tables::FastTableConfig, formatter::FormatterConfig, graph::GraphConfig, - make::{MakeTargets, VerboseLevel, HELP_BLOCK_SELECTION}, + make::{HELP_BLOCK_SELECTION, MakeTargets, VerboseLevel}, + monsters::MonsterConfig, statsolver::StatConfig, tablegen::{Craft, TableArgs}, }; @@ -48,6 +49,8 @@ pub enum Commands { Analysis(AnalysisConfig), /// Better Generation BetterGen(FastTableConfig), + /// Monster database handling + Monsters(MonsterConfig), } #[derive(Debug, Args)] diff --git a/crates/config/src/lib.rs b/crates/config/src/lib.rs index e6b05c2..58c5607 100644 --- a/crates/config/src/lib.rs +++ b/crates/config/src/lib.rs @@ -12,5 +12,6 @@ pub mod fast_tables; pub mod formatter; pub mod graph; pub mod make; +pub mod monsters; pub mod statsolver; pub mod tablegen; diff --git a/crates/config/src/monsters.rs b/crates/config/src/monsters.rs new file mode 100644 index 0000000..4f538fc --- /dev/null +++ b/crates/config/src/monsters.rs @@ -0,0 +1,28 @@ +// Workspace: config +// File: config/src/monsters.rs +//! The inner config for monster module +//! + +use clap::{Args, ValueEnum}; + +#[derive(Args, Debug, Clone)] +/// The configuration struct for the Graph +pub struct MonsterConfig { + /// Special target + pub target: MonsterTarget, + + /// Clean all the artefacts (including generated images) + #[arg(short, long)] + pub all: bool, +} + +#[derive(ValueEnum, Debug, Clone)] +/// The action to execute +pub enum MonsterTarget { + /// Clean the generated monsters directory + Clean, + /// Generate the monster list + Export, + /// Show useful data + Show, +} diff --git a/crates/monsters/Cargo.toml b/crates/monsters/Cargo.toml new file mode 100644 index 0000000..522d216 --- /dev/null +++ b/crates/monsters/Cargo.toml @@ -0,0 +1,25 @@ +[package] +name = "monsters" +edition = "2024" +version.workspace = true + +[dependencies] +config = {workspace = true} +cli_parser = {workspace = true} +more_fields = {workspace = true} +anyhow = {workspace = true} +# regex = {workspace = true} +# csv = {workspace = true} +# serde = {workspace = true} +# comfy-table = "7.2.2" +# probability = "0.20.3" +rusqlite = { version = "0.40.1" } # , features = ["bundled"] +serde_rusqlite = "0.43.0" +# serde_json = { version = "1.0.150", features = ["alloc"] } +strum = { version = "0.28.0", features = ["derive"] } +# charming = { version = "0.4.0", features = [] } + +[dev-dependencies] +regex = {workspace = true} +pretty_assertions = {workspace = true} +clap = {workspace = true} diff --git a/crates/monsters/src/lib.rs b/crates/monsters/src/lib.rs new file mode 100644 index 0000000..b49078d --- /dev/null +++ b/crates/monsters/src/lib.rs @@ -0,0 +1,29 @@ +//! # Monsters Module +//! +//! The `monsters` crate orchestrates the processing of *ravenous* monster data. +//! +//! It can: +//! * **Parse** raw monster definitions into ergonomic Rust structs. +//! * Perform **balancing** calculations to keep encounters fair. +//! * **Show** concise, human‑readable summaries in the terminal. +//! * **Export** processed data as LaTeX/TeX for printing or further editing. +//! +//! All functionality is exposed through a single entry point: +//! [`monsters_dispatch`]. The dispatcher interprets command‑line arguments +//! (`MonsterConfig`) and delegates to the appropriate sub‑routine (clean, export or show). +//! + +use anyhow::Result; +use cli_parser::Config; +use config::monsters::MonsterConfig; + +/// Dispatches the chosen monster action. +pub fn monsters_dispatch(args: &MonsterConfig, _config: &Config) -> Result<()> { + use config::monsters::MonsterTarget; + + match args.target { + MonsterTarget::Clean => todo!("implement cleaning logic"), + MonsterTarget::Export => todo!("implement export logic"), + MonsterTarget::Show => todo!("implement show logic"), + } +} diff --git a/crates/ravenous-tools/Cargo.toml b/crates/ravenous-tools/Cargo.toml index 6044cd9..8fcf3e7 100644 --- a/crates/ravenous-tools/Cargo.toml +++ b/crates/ravenous-tools/Cargo.toml @@ -17,6 +17,7 @@ clap = {workspace = true} tokio = {workspace = true} formatter = {workspace = true} weaponry = {workspace = true} +monsters = {workspace = true} [package.metadata.cargo-machete] ignored = ["tokio"] diff --git a/crates/ravenous-tools/src/main.rs b/crates/ravenous-tools/src/main.rs index 826a1bd..86d8bf1 100644 --- a/crates/ravenous-tools/src/main.rs +++ b/crates/ravenous-tools/src/main.rs @@ -10,6 +10,7 @@ use fast_class::make_better_gen; use formatter::format_file; use graphs::make_graphs; use make::make_pdf; +use monsters::monsters_dispatch; use stats::stat_solver; use tablegen::table_gen; use weaponry::analysis::launch_analysis; @@ -37,6 +38,7 @@ fn main() -> Result<()> { Commands::Format(args) => format_file(&args, &config), Commands::Analysis(args) => Ok(launch_analysis(&args, &config)?), // Not using anyhow but a custom error Commands::BetterGen(args) => make_better_gen(&args, &config), + Commands::Monsters(args) => monsters_dispatch(&args, &config), } }