Pick this up again, dust it off, get some stuff connected.
This commit is contained in:
30
src/bin.rs
30
src/bin.rs
@@ -1,3 +1,29 @@
|
||||
fn main() {
|
||||
println!("Hello, world!");
|
||||
use clap::Parser;
|
||||
use ngr::syntax::{ParserError, Program};
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[clap(author, version, about, long_about = None)]
|
||||
struct CommandLineArguments {
|
||||
/// Optional output file name
|
||||
#[clap(short, long)]
|
||||
output: Option<String>,
|
||||
|
||||
/// The file to parse
|
||||
file: String
|
||||
}
|
||||
|
||||
fn real_main() -> Result<(), ParserError> {
|
||||
let args = CommandLineArguments::parse();
|
||||
|
||||
let program = Program::from_file(&args.file)?;
|
||||
println!("args: {:?}", args);
|
||||
println!("program: {:?}", program);
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn main() {
|
||||
if let Err(e) = real_main() {
|
||||
println!("{}", e);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user