diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-30 22:54:55 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-30 22:54:55 -0700 |
commit | 1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc (patch) | |
tree | 94dcb86d1854c43f0f67e2642ce0d763c550b618 /src/bin | |
parent | a4dbcbaf4b54a7e82533f671ab9a7064feb0ee71 (diff) | |
download | geniza-1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc.tar.gz geniza-1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc.zip |
add verify command to geniza-sleep
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/geniza-sleep.rs | 15 |
1 files changed, 12 insertions, 3 deletions
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 @@ -38,6 +38,12 @@ fn run() -> Result<()> { .arg_from_usage("<index> 'index of the data chunk to dump'"), ) .subcommand( + SubCommand::with_name("verify") + .about("Verifies the given register") + .arg_from_usage("<DIR> 'directory containing files'") + .arg_from_usage("<prefix> 'prefix for each data file'") + ) + .subcommand( SubCommand::with_name("file-info") .about("Reads a single SLEEP file and shows some basic metadata") .arg_from_usage("<FILE> 'SLEEP file to read'"), @@ -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: '{}'", |