Start with SchematicsFactory and bin

This commit is contained in:
Adrian Heine 2017-09-22 15:13:12 +02:00
parent c91eb2f04e
commit 0bc56a8f69
8 changed files with 157 additions and 30 deletions

13
src/bin.rs Normal file
View file

@ -0,0 +1,13 @@
use std::process::exit;
use std::env;
pub fn schematics_main(run: &Fn (bool) -> Result<(), ()>) {
let args: Vec<String> = env::args().collect();
let dry_run = match args.len() {
1 => false,
2 => if args[1] == "--dry-run" { true } else { panic!() },
_ => panic!()
};
exit(match run(dry_run) { Ok(_) => 0, Err(_) => 1 });
}