yog-cli 0.52.0

Yog build tool — `yog build` compiles a mod and packages it as .yog.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//! `yog schema <format>`: the format's shape (`yog_data::Shape::describe`)
//! as JSON — what editors and docs are generated from.

pub(super) const WORDS: &[&str] = &["schema"];

pub(super) fn run(rest: &[String]) -> Result<(), String> {
    let all = || yog_formats::names().collect::<Vec<_>>().join(", ");
    let name = rest
        .first()
        .ok_or_else(|| format!("usage: yog schema <format> — {}", all()))?;
    let shape =
        yog_formats::shape_of(name).ok_or_else(|| format!("no format `{name}` — {}", all()))?;
    println!("{}", yog_data::text::to_string_pretty(&shape.describe()));
    Ok(())
}