diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-26 21:10:19 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-26 21:10:22 -0700 |
commit | 177d639fab67b790f43bc0573d785271d8afb858 (patch) | |
tree | 7eaefcfc7bc508e00aa633c80983ed90179f84ec /src/bin/geniza-register.rs | |
parent | 594807d6ef0954ff8ca0b99cf41329c0ad3252e7 (diff) | |
download | geniza-177d639fab67b790f43bc0573d785271d8afb858.tar.gz geniza-177d639fab67b790f43bc0573d785271d8afb858.zip |
refactor file/module names
I had some early confusion around whether SLEEP refered to individual
files or the collection of files making a register (it seems to mean the
whole register).
Will probably need to refactor again.
Diffstat (limited to 'src/bin/geniza-register.rs')
-rw-r--r-- | src/bin/geniza-register.rs | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/src/bin/geniza-register.rs b/src/bin/geniza-register.rs deleted file mode 100644 index a328bbc..0000000 --- a/src/bin/geniza-register.rs +++ /dev/null @@ -1,54 +0,0 @@ - -#[macro_use] -extern crate error_chain; -extern crate clap; -extern crate env_logger; -extern crate geniza; - -// TODO: more careful import -use geniza::*; -use std::path::Path; -use clap::{App, SubCommand}; - -fn run() -> Result<()> { - - env_logger::init().unwrap(); - - let matches = App::new("geniza-register") - .version(env!("CARGO_PKG_VERSION")) - .subcommand(SubCommand::with_name("info") - .about("Reads a SLEEP dir register and shows some basic metadata") - .arg_from_usage("<DIR> 'directory containing files'") - .arg_from_usage("<prefix> 'prefix for each data file'")) - .subcommand(SubCommand::with_name("create") - .about("Creates an SLEEP directory register (with header)") - .arg_from_usage("<DIR> 'directory containing files'") - .arg_from_usage("<prefix> 'prefix for each data file'")) - .get_matches(); - - - match matches.subcommand() { - ("info", 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)?; - //debug!(println!("{:?}", sdr)); - println!("Entry count: {}", sdr.len()?); - println!("Total size (bytes): {}", sdr.len_bytes()?); - }, - ("create", Some(subm)) => { - let dir = Path::new(subm.value_of("DIR").unwrap()); - let prefix = subm.value_of("prefix").unwrap(); - SleepDirRegister::create(dir, prefix)?; - println!("Done!"); - }, - _ => { - println!("Missing or unimplemented command!"); - println!("{}", matches.usage()); - ::std::process::exit(-1); - }, - } - Ok(()) -} - -quick_main!(run); |