36 lines
825 B
Rust
36 lines
825 B
Rust
use std::path::Path;
|
|
|
|
use clap::Parser;
|
|
|
|
pub mod cli;
|
|
pub mod error;
|
|
pub mod gitea;
|
|
pub mod model;
|
|
pub mod normalize;
|
|
pub mod output;
|
|
pub mod render;
|
|
|
|
use crate::cli::{Cli, Commands, OutputFormat};
|
|
use crate::output::write_output;
|
|
use crate::render::json::{parse_json, render_json};
|
|
use crate::render::markdown::render_markdown;
|
|
|
|
pub fn run() -> anyhow::Result<()> {
|
|
let cli = Cli::parse();
|
|
|
|
match cli.command {
|
|
Commands::RenderMd(args) => {
|
|
let raw = std::fs::read_to_string(&args.input)?;
|
|
let doc = parse_json(&raw)?;
|
|
let md = render_markdown(&doc);
|
|
write_output(args.out.as_deref().map(Path::new), &md)?;
|
|
}
|
|
Commands::Fetch(_args) => {
|
|
let _ = OutputFormat::Markdown;
|
|
let _ = render_json;
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|