mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-05-18 23:19:30 +00:00
Agent-Logs-Url: https://github.com/logos-blockchain/lez-programs/sessions/c96af723-7390-4496-9838-2cdd2083ab3d Co-authored-by: 3esmit <224810+3esmit@users.noreply.github.com>
26 lines
693 B
Rust
26 lines
693 B
Rust
use std::{path::PathBuf, process};
|
|
|
|
fn main() {
|
|
let path: PathBuf = match std::env::args().nth(1) {
|
|
Some(p) => PathBuf::from(p),
|
|
None => {
|
|
eprintln!("Usage: idl-gen <source-file>");
|
|
process::exit(1);
|
|
}
|
|
};
|
|
|
|
match spel_framework_core::idl_gen::generate_idl_from_file(&path) {
|
|
Ok(idl) => match serde_json::to_string_pretty(&idl) {
|
|
Ok(json) => println!("{json}"),
|
|
Err(e) => {
|
|
eprintln!("Error serializing IDL to JSON: {e}");
|
|
process::exit(1);
|
|
}
|
|
},
|
|
Err(e) => {
|
|
eprintln!("Error: {e}");
|
|
process::exit(1);
|
|
}
|
|
}
|
|
}
|