dyesub-tool/dyesub-cli/src/main.rs
2023-08-22 16:50:05 -07:00

28 lines
606 B
Rust

#![feature(path_file_prefix)]
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(())
}