holey-bytes/hblang/src/main.rs

20 lines
645 B
Rust
Raw Normal View History

2024-06-01 13:30:07 -05:00
fn main() -> std::io::Result<()> {
2024-06-25 14:41:12 -05:00
let args = std::env::args().collect::<Vec<_>>();
let args = args.iter().map(String::as_str).collect::<Vec<_>>();
2024-05-12 17:02:32 -05:00
2024-06-25 14:41:12 -05:00
if args.contains(&"--help") || args.contains(&"-h") {
println!("Usage: hbc [OPTIONS...] <FILE>");
println!(include_str!("../command-help.txt"));
return Err(std::io::ErrorKind::Other.into());
}
2024-05-12 17:02:32 -05:00
2024-07-06 07:58:50 -05:00
hblang::run_compiler(
args.get(1).copied().unwrap_or("main.hb"),
hblang::Options {
fmt: args.contains(&"--fmt"),
fmt_current: args.contains(&"--fmt-current"),
},
&mut std::io::stdout(),
)
2024-05-12 17:02:32 -05:00
}