From 1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc Mon Sep 17 00:00:00 2001 From: Bryan Newbold Date: Mon, 30 Oct 2017 22:54:55 -0700 Subject: add verify command to geniza-sleep --- src/bin/geniza-sleep.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'src/bin') diff --git a/src/bin/geniza-sleep.rs b/src/bin/geniza-sleep.rs index 2e504b0..582b766 100644 --- a/src/bin/geniza-sleep.rs +++ b/src/bin/geniza-sleep.rs @@ -37,6 +37,12 @@ fn run() -> Result<()> { .arg_from_usage(" 'prefix for each data file'") .arg_from_usage(" 'index of the data chunk to dump'"), ) + .subcommand( + SubCommand::with_name("verify") + .about("Verifies the given register") + .arg_from_usage(" 'directory containing files'") + .arg_from_usage(" 'prefix for each data file'") + ) .subcommand( SubCommand::with_name("file-info") .about("Reads a single SLEEP file and shows some basic metadata") @@ -75,7 +81,6 @@ fn run() -> Result<()> { let dir = Path::new(subm.value_of("DIR").unwrap()); let prefix = subm.value_of("prefix").unwrap(); let mut sdr = SleepDirRegister::open(dir, prefix, false)?; - //debug!(println!("{:?}", sdr)); println!("Entry count: {}", sdr.len()?); println!("Total size (bytes): {}", sdr.len_bytes()?); } @@ -90,13 +95,17 @@ fn run() -> Result<()> { let prefix = subm.value_of("prefix").unwrap(); let index = value_t_or_exit!(subm, "index", u64); let mut sdr = SleepDirRegister::open(dir, prefix, false)?; - //debug!(println!("{:?}", sdr)); println!("{:?}", sdr.get_data_entry(index)?); } + ("verify", Some(subm)) => { + let dir = Path::new(subm.value_of("DIR").unwrap()); + let prefix = subm.value_of("prefix").unwrap(); + let mut sdr = SleepDirRegister::open(dir, prefix, false)?; + println!("{:?}", sdr.verify()); + } ("file-info", Some(subm)) => { let path = Path::new(subm.value_of("FILE").unwrap()); let sf = SleepFile::open(path, false)?; - //debug!(println!("{:?}", sf)); println!("Magic: 0x{:X}", sf.get_magic()); println!( "Algorithm: '{}'", -- cgit v1.2.3