24 lines
765 B
Rust
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);
|
|
}
|
|
}
|
|
}
|