diff options
-rw-r--r-- | src/bin/geniza-sleep.rs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/bin/geniza-sleep.rs b/src/bin/geniza-sleep.rs index 168f803..b7bb88e 100644 --- a/src/bin/geniza-sleep.rs +++ b/src/bin/geniza-sleep.rs @@ -23,6 +23,9 @@ fn run() -> Result<()> { .arg_from_usage("<magic> 'Magic word to use (eg, 0x5025700)'") .arg_from_usage("<entry_size> 'Size of each entry (bytes)'") .arg_from_usage("<algo_name> 'Name of algorithm (empty string for none)'")) + .subcommand(SubCommand::with_name("read-all") + .about("Reads a SLEEP file, iterates through all entries, prints raw bytes") + .arg_from_usage("<FILE> 'SLEEP file to read'")) .get_matches(); @@ -51,6 +54,13 @@ fn run() -> Result<()> { algo_name)?; println!("Done!"); }, + ("read-all", Some(subm)) => { + let path = Path::new(subm.value_of("FILE").unwrap()); + let mut sf = SleepFile::open(path, false)?; + for i in 0..sf.length()? { + println!("{}: {:?}", i, sf.read(i)); + } + }, _ => { println!("Missing or unimplemented command!"); println!("{}", matches.usage()); |