use std::process::exit; use clap::Parser; use rox::cli::{Cli, Commands}; use tracing::error; /// Cli entrypoint. fn main() { if std::env::var_os("RUST_LOG").is_none() { std::env::set_var("RUST_LOG", "info"); } tracing_subscriber::fmt::init(); let cli = Cli::parse(); match &cli.command { Commands::Compile(compile_config) => { if !&compile_config.source.exists() { error!( "{} does not exist", &compile_config.source.to_string_lossy() ); exit(1); } if let Err(e) = rox::compile(&compile_config.source) { error!( "failed to compile {}: {}", &compile_config.source.to_string_lossy(), e ); } } Commands::Repl => { rox::repl(); } } }