d94cb2df4c
- Fix trailing whitespace in kex.rs and s3.rs - Add missing KexProposal import in kex_complete.rs - Auto-fix clippy warnings across all crates - All 153 tests pass
27 lines
636 B
Rust
27 lines
636 B
Rust
use clap::Subcommand;
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum RenderCommand {
|
|
File {
|
|
#[arg(short, long)]
|
|
file: String,
|
|
#[arg(short, long)]
|
|
output: Option<String>,
|
|
},
|
|
}
|
|
|
|
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(())
|
|
}
|