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

Writes the art as the file the app reads. gen-art <file> writes it there; with no argument, prints it.

3fn main() {
4    let text = whiskers_art::data::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 art file");
11        }
12        None => print!("{text}"),
13    }
14}