ableos/hblang/src/main.rs

20 lines
637 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 {
2024-07-08 00:22:53 -05:00
fmt: args.contains(&"--fmt"),
2024-07-06 07:58:50 -05:00
fmt_current: args.contains(&"--fmt-current"),
},
&mut std::io::stdout(),
)
2024-05-12 17:02:32 -05:00
}