mod docgen; mod path; use std::{env, error::Error}; type DynError = Box; pub mod tasks { use crate::docgen::USER_GUIDE; use crate::docgen::{userguide, write}; use crate::DynError; pub fn docgen() -> Result<(), DynError> { write(USER_GUIDE, &userguide()?); Ok(()) } pub fn print_help() { println!( " Usage: `cargo xtask ` Tasks: docgen: Generate Markdown files. " ); } } fn main() -> Result<(), DynError> { let task = env::args().nth(1); match task { None => tasks::print_help(), Some(t) => match t.as_str() { "docgen" => tasks::docgen()?, invalid => return Err(format!("Invalid task: {}", invalid).into()), }, }; Ok(()) }