use clap::Subcommand; #[derive(Subcommand)] pub enum RenderCommand { File { #[arg(short, long)] file: String, #[arg(short, long)] output: Option, }, } pub fn handle_render_command(cmd: RenderCommand) -> anyhow::Result<()> { match cmd { RenderCommand::File { file, output } => { let md = std::fs::read_to_string(&file)?; let html = crate::render::md_to_html(&md); if let Some(path) = &output { std::fs::write(path, html)?; } else { println!("{html}"); } } } Ok(()) }