From 54fd4040da07f06390274a4a6b561a55196d48a3 Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Sun, 5 Nov 2017 11:16:47 -0800 Subject: add dump-entries debug command to geniza-drive --- src/bin/geniza-drive.rs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/bin/geniza-drive.rs b/src/bin/geniza-drive.rs index 32104e4..79ad517 100644 --- a/src/bin/geniza-drive.rs +++ b/src/bin/geniza-drive.rs @@ -37,6 +37,10 @@ fn run() -> Result<()> { SubCommand::with_name("verify") .about("Checks signatures et al") ) + .subcommand( + SubCommand::with_name("dump-entries") + .about("Dump all entries in a debug-friendly format") + ) .get_matches(); let dir = Path::new(matches.value_of("dat-dir").unwrap()); @@ -70,6 +74,21 @@ fn run() -> Result<()> { let mut drive = DatDrive::open(dir, false)?; println!("{:?}", drive.verify()); } + ("dump-entries", Some(_subm)) => { + let mut drive = DatDrive::open(dir, false)?; + for entry in drive.history(0) { + let entry = entry?; + println!("{}\tpath: {}", + entry.index, entry.path.display()); + println!("\tchildren: {:?}", + entry.children); + if let Some(_) = entry.stat { + println!("\tstat: Some (add/change)"); + } else { + println!("\tstat: None (delete)"); + } + } + } _ => { println!("Missing or unimplemented command!"); println!("{}", matches.usage()); -- cgit v1.2.3