cli: implement SES export

This commit is contained in:
Szpachlarz 2024-07-13 14:48:38 +02:00
parent 9e2a0acab0
commit 8d2db0a0dc
1 changed files with 10 additions and 9 deletions

View File

@ -7,7 +7,7 @@ use std::io::BufReader;
struct Cli { struct Cli {
input: std::path::PathBuf, input: std::path::PathBuf,
output: std::path::PathBuf, output: std::path::PathBuf,
history: Option<std::path::PathBuf>, history: std::path::PathBuf,
} }
fn main() -> Result<(), std::io::Error> { 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 design = topola::specctra::design::SpecctraDesign::load(design_bufread).unwrap();
let board = design.make_board(); let board = design.make_board();
if let Some(history) = args.history { let history_file = File::open(args.history)?;
let history_file = File::open(history)?;
let mut history_bufread = BufReader::new(history_file); let mut history_bufread = BufReader::new(history_file);
let mut invoker = topola::autorouter::invoker::Invoker::new( let mut invoker = topola::autorouter::invoker::Invoker::new(
topola::autorouter::Autorouter::new(board).unwrap(), topola::autorouter::Autorouter::new(board).unwrap(),
); );
invoker.replay(serde_json::from_reader(history_bufread).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(()) Ok(())
} }