flowrs-engine/crates/flowrs-core/examples/linux_program.rs
flowRS fd958c0547 flowRS engine, cut from flowRS 3451b065
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-11-02 19:04:39 -05:00

24 lines
765 B
Rust

//! Prints the `src/app.rs` a graph lowers to for the forge's Linux skeleton
//! (`codegen::linux::to_linux_app`): the demo graph's, or the graph in a JSON file.
//!
//! ```text
//! cargo run -p flowrs-core --example linux_program [-- graph.json] > app.rs
//! ```
use flowrs_core::codegen::linux::{demo_graph, to_linux_app};
use flowrs_core::graph::Graph;
fn main() {
let graph: Graph = match std::env::args().nth(1) {
Some(path) => serde_json::from_slice(&std::fs::read(&path).expect("read the graph"))
.expect("a flowRS graph"),
None => demo_graph(),
};
match to_linux_app(&graph, 1) {
Ok(p) => print!("{p}"),
Err(e) => {
eprintln!("{e}");
std::process::exit(1);
}
}
}