mirror of
https://github.com/azur1s/bobbylisp.git
synced 2024-10-16 02:37:40 -05:00
feat: unoptionize command
This commit is contained in:
parent
dc3d400d50
commit
8230151489
|
@ -6,7 +6,7 @@ use structopt::StructOpt;
|
|||
#[structopt(name = "blspc")]
|
||||
pub struct Opts {
|
||||
#[structopt(subcommand)]
|
||||
pub commands: Option<Args>,
|
||||
pub commands: Args,
|
||||
}
|
||||
|
||||
#[derive(StructOpt, Debug)]
|
||||
|
|
|
@ -17,20 +17,17 @@ use vm::{vm::VM, parser::parse_instr};
|
|||
fn main() {
|
||||
let start = Instant::now();
|
||||
let args = Opts::from_args();
|
||||
|
||||
if let Some(commands) = args.commands {
|
||||
match commands {
|
||||
args::Args::Compile(args) => {
|
||||
let src = read_to_string(&args.file).unwrap();
|
||||
let debug = args.debug;
|
||||
compile_src(src, args.output, args.file, debug, start);
|
||||
},
|
||||
args::Args::Run(args) => {
|
||||
let src = read_to_string(&args.file).unwrap();
|
||||
let debug = args.debug;
|
||||
run_src(src, debug);
|
||||
},
|
||||
}
|
||||
match args.commands {
|
||||
args::Args::Compile(args) => {
|
||||
let src = read_to_string(&args.file).unwrap();
|
||||
let debug = args.debug;
|
||||
compile_src(src, args.output, args.file, debug, start);
|
||||
},
|
||||
args::Args::Run(args) => {
|
||||
let src = read_to_string(&args.file).unwrap();
|
||||
let debug = args.debug;
|
||||
run_src(src, debug);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue