diff --git a/src/bin/topola-cli/main.rs b/src/bin/topola-cli/main.rs index 346b4ae..1df7cc5 100644 --- a/src/bin/topola-cli/main.rs +++ b/src/bin/topola-cli/main.rs @@ -7,7 +7,7 @@ use std::io::BufReader; struct Cli { input: std::path::PathBuf, output: std::path::PathBuf, - history: Option, + history: std::path::PathBuf, } fn main() -> Result<(), std::io::Error> { @@ -19,14 +19,15 @@ fn main() -> Result<(), std::io::Error> { let design = topola::specctra::design::SpecctraDesign::load(design_bufread).unwrap(); let board = design.make_board(); - if let Some(history) = args.history { - let history_file = File::open(history)?; - let mut history_bufread = BufReader::new(history_file); - let mut invoker = topola::autorouter::invoker::Invoker::new( - topola::autorouter::Autorouter::new(board).unwrap(), - ); - invoker.replay(serde_json::from_reader(history_bufread).unwrap()) - } + let history_file = File::open(args.history)?; + let mut history_bufread = BufReader::new(history_file); + let mut invoker = topola::autorouter::invoker::Invoker::new( + topola::autorouter::Autorouter::new(board).unwrap(), + ); + invoker.replay(serde_json::from_reader(history_bufread).unwrap()); + + let mut file = File::create(args.output).unwrap(); + design.write_ses(invoker.autorouter().board(), &mut file); Ok(()) }