diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-17 22:15:53 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2017-10-17 22:15:53 -0700 |
commit | 05e4db9271cbcbd7be28c7f2b3fd0df85b12a358 (patch) | |
tree | 8f7b2302aff59b1f4393427182dd680253fe500b /src/bin | |
parent | 2b62ec4e60f973a8c49ef39c8935c64dca8beef4 (diff) | |
download | geniza-05e4db9271cbcbd7be28c7f2b3fd0df85b12a358.tar.gz geniza-05e4db9271cbcbd7be28c7f2b3fd0df85b12a358.zip |
cleanups
Diffstat (limited to 'src/bin')
-rw-r--r-- | src/bin/geniza-register.rs | 22 | ||||
-rw-r--r-- | src/bin/geniza-sleep.rs | 22 |
2 files changed, 6 insertions, 38 deletions
diff --git a/src/bin/geniza-register.rs b/src/bin/geniza-register.rs index 6962be1..8d70655 100644 --- a/src/bin/geniza-register.rs +++ b/src/bin/geniza-register.rs @@ -1,7 +1,7 @@ #[macro_use] +extern crate error_chain; extern crate clap; - extern crate geniza; // TODO: more careful import @@ -32,6 +32,7 @@ fn run() -> Result<()> { let 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()); @@ -48,21 +49,4 @@ fn run() -> Result<()> { Ok(()) } -// TODO: is there a shorter error_chain 'main()' to use here? -fn main() { - if let Err(ref e) = run() { - println!("error: {}", e); - - for e in e.iter().skip(1) { - println!("caused by: {}", e); - } - - // The backtrace is not always generated. Try to run this example - // with `RUST_BACKTRACE=1`. - if let Some(backtrace) = e.backtrace() { - println!("backtrace: {:?}", backtrace); - } - - ::std::process::exit(1); - } -} +quick_main!(run); diff --git a/src/bin/geniza-sleep.rs b/src/bin/geniza-sleep.rs index 5061dc9..8c5c849 100644 --- a/src/bin/geniza-sleep.rs +++ b/src/bin/geniza-sleep.rs @@ -1,7 +1,8 @@ #[macro_use] +extern crate error_chain; +#[macro_use] extern crate clap; - extern crate geniza; // TODO: more careful import @@ -70,21 +71,4 @@ fn run() -> Result<()> { Ok(()) } -// TODO: is there a shorter error_chain 'main()' to use here? -fn main() { - if let Err(ref e) = run() { - println!("error: {}", e); - - for e in e.iter().skip(1) { - println!("caused by: {}", e); - } - - // The backtrace is not always generated. Try to run this example - // with `RUST_BACKTRACE=1`. - if let Some(backtrace) = e.backtrace() { - println!("backtrace: {:?}", backtrace); - } - - ::std::process::exit(1); - } -} +quick_main!(run); |