whiskers.git / crates / whiskers-art / src / bin / gen-kotlin.rs

Writes the grey cat as Kotlin. gen-kotlin <out-file>; with no argument, prints it.

3fn main() {
4    let text = whiskers_art::kotlin::generate();
5    match std::env::args().nth(1) {
6        Some(path) => {
7            if let Some(dir) = std::path::Path::new(&path).parent() {
8                std::fs::create_dir_all(dir).expect("create the output directory");
9            }
10            std::fs::write(&path, text).expect("write the Kotlin file");
11        }
12        None => print!("{text}"),
13    }
14}