breb 0.5.0

the blog/reblog library and command-line tool
Documentation
use std::{env, path::Path, thread, time::Duration};

use breb::LiveServer;

fn main() {
	let port = env::args().nth(1)
		.map(|s| s.parse::<u16>())
		.transpose()
		.expect("that port wasn't an integer");

	let Ok(manifest_dir) = env::var("CARGO_MANIFEST_DIR") else {
		panic!("you need to run this as an example with cargo.");
	};
	let manifest_dir = Path::new(&manifest_dir);
	let example_dir = manifest_dir.join("examples/simple/");

	let in_bg = LiveServer::live_config(example_dir.join("breb.yml"), example_dir)
		.listen_background(port)
		.expect("failed to start server");
	println!("server is listening on http://{}", in_bg.address);
	// wait for ctrl+c
	loop {
		thread::sleep(Duration::MAX);
	}
}