dyesub-tool/dyesub-cli/src/main.rs

26 lines
575 B
Rust

use std::path::PathBuf;
use clap::Parser;
use clap_derive::Parser;
use dyesub::Result;
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
/// Input KLE JSON path
input: PathBuf,
/// Output SVG path
#[arg(short, long)]
output: Option<PathBuf>,
}
fn main() -> Result<()> {
let args = Args::parse();
let output = args.output.unwrap_or_else(|| {
let mut path = args.input.clone();
path.set_extension("svg");
path
});
dyesub::render_file(&args.input, &output)?;
Ok(())
}