Add reexport command
This commit is contained in:
parent
266f001d46
commit
e74eee89e6
3 changed files with 25 additions and 0 deletions
17
brood/src/commands/reexport.rs
Normal file
17
brood/src/commands/reexport.rs
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
use std::fs::File;
|
||||
use std::io::{self, BufReader, BufWriter};
|
||||
use std::path::Path;
|
||||
|
||||
use crate::data::AdjacencyList;
|
||||
|
||||
pub fn reexport(from: &Path, to: &Path) -> io::Result<()> {
|
||||
eprintln!(">> Import");
|
||||
let from = BufReader::new(File::open(from)?);
|
||||
let data = AdjacencyList::read(from)?;
|
||||
|
||||
eprintln!(">> Export");
|
||||
let to = BufWriter::new(File::create(to)?);
|
||||
data.write(to)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue