aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/geniza-register.rs22
-rw-r--r--src/bin/geniza-sleep.rs22
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);