aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryan Newbold <bnewbold@robocracy.org>2017-10-30 22:54:55 -0700
committerBryan Newbold <bnewbold@robocracy.org>2017-10-30 22:54:55 -0700
commit1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc (patch)
tree94dcb86d1854c43f0f67e2642ce0d763c550b618
parenta4dbcbaf4b54a7e82533f671ab9a7064feb0ee71 (diff)
downloadgeniza-1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc.tar.gz
geniza-1c2bf46bfc67b64d038d6f7bdfe775fbee73f5fc.zip
add verify command to geniza-sleep
-rw-r--r--src/bin/geniza-sleep.rs15
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: '{}'",