use common::{self as _};

use assembler::prelude::*;
use std::{fs, io::Write, path::PathBuf};

fn main() {
    // Parse command line arguments
    let args: Vec<String> = std::env::args().collect();

    let input_path = &args[1];
    let output_path = &args[2];

    let mut engine = Assembler::new(PathBuf::from(input_path));
    engine.start(());
    let result = engine.output().expect("assembler failed.");

    if let Err(e) = fs::write(output_path, result) {
        eprintln!("Failed to write to output file: {e}");
        std::process::exit(1);
    }
}
