From 0597b1d4f818e7f80e9f48380a6e9b4b5ab9a991 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Sat, 6 Jan 2024 14:05:41 -0500 Subject: [PATCH] command line argument for program --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 5e0d957..f60e0c8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,10 +4,12 @@ mod vm; use crate::vm::VM; +use std::env; fn main() { - let mut vm = VM::new(); + let args : Vec<_> = env::args().collect(); - vm.read_program(&"programs/hello-world.obj".to_string()); + let mut vm = VM::new(); + vm.read_program(args.get(1).expect("No program file given")); vm.execute(); }