Files
improvise/examples/pretty-print.rs
T
Edward Langley e8e7a7f1fe refactor(panels, examples): cap the remaining runs
The panel migration tests (improvise-35e) keep their claim and lose their
history; tile_bar's scroll loop keeps its algorithm note. gen-grammar's
usage block is trimmed to the one line a reader runs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-20 09:51:38 -07:00

23 lines
627 B
Rust

//! Parse a `.improv` file from stdin and print the formatted result to stdout:
//! `cargo run --example pretty-print < file.improv`.
use std::io::Read;
fn main() {
let mut input = String::new();
if let Err(e) = std::io::stdin().read_to_string(&mut input) {
eprintln!("Failed to read stdin: {e}");
std::process::exit(1);
}
match improvise::persistence::parse_md(&input) {
Ok(model) => {
print!("{}", improvise::persistence::format_md(&model));
}
Err(e) => {
eprintln!("Parse error: {e:#}");
std::process::exit(1);
}
}
}