diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-11-05 11:16:47 -0800 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-11-05 11:16:47 -0800 |
commit | 54fd4040da07f06390274a4a6b561a55196d48a3 (patch) | |
tree | 5b290200fce7fcd71cf4be1ffef5d95ae568aa77 | |
parent | bd80b08771ed8f25a445d146f066a12feca450c3 (diff) | |
download | geniza-54fd4040da07f06390274a4a6b561a55196d48a3.tar.gz geniza-54fd4040da07f06390274a4a6b561a55196d48a3.zip |
add dump-entries debug command to geniza-drive
-rw-r--r-- | src/bin/geniza-drive.rs | 19 |
1 files changed, 19 insertions, 0 deletions
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()); |