1
1
Fork 0
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:
Natapat Samutpong 2022-01-28 07:09:31 +07:00
parent dc3d400d50
commit 8230151489
2 changed files with 13 additions and 16 deletions

View file

@ -6,7 +6,7 @@ use structopt::StructOpt;
#[structopt(name = "blspc")] #[structopt(name = "blspc")]
pub struct Opts { pub struct Opts {
#[structopt(subcommand)] #[structopt(subcommand)]
pub commands: Option<Args>, pub commands: Args,
} }
#[derive(StructOpt, Debug)] #[derive(StructOpt, Debug)]

View file

@ -17,9 +17,7 @@ use vm::{vm::VM, parser::parse_instr};
fn main() { fn main() {
let start = Instant::now(); let start = Instant::now();
let args = Opts::from_args(); let args = Opts::from_args();
match args.commands {
if let Some(commands) = args.commands {
match commands {
args::Args::Compile(args) => { args::Args::Compile(args) => {
let src = read_to_string(&args.file).unwrap(); let src = read_to_string(&args.file).unwrap();
let debug = args.debug; let debug = args.debug;
@ -32,7 +30,6 @@ fn main() {
}, },
} }
} }
}
fn compile_src(src: String, path: Option<PathBuf>, file: PathBuf, debug: bool, start: Instant) { fn compile_src(src: String, path: Option<PathBuf>, file: PathBuf, debug: bool, start: Instant) {
let file_name = match path { let file_name = match path {