summaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 6f5a695ee77ba43ed09e362206decd4f2c6aeb60 (plain)
use std::path::{Path, PathBuf};

use bpaf::Bpaf;
use tortuise::{apply_patches, file::FileManager, init_logger, script::WasmRunner};

#[derive(Debug, Clone, Bpaf)]
#[bpaf(options)]
struct Options {
	module: PathBuf,
}

fn main() {
	let mut files = FileManager::default();
	let wasm_runner = WasmRunner::new();

	let options = options().run();
	let path: Box<Path> = options.module.into();
	let manifest_script = files.load_file(path.clone(), &wasm_runner);
	let manifest_script = manifest_script.as_ref().as_ref().unwrap();
	let mut manifest = wasm_runner.manifest(path.clone(), manifest_script).unwrap();
	init_logger(&manifest);
	if let Err(e) = apply_patches(&mut manifest, &mut files, &wasm_runner) {
		log::error!("{}", e);
	};
	tortuise::run_game(files, wasm_runner, manifest);
}