diff options
author | Lars Wirzenius <liw@liw.fi> | 2021-04-22 10:31:54 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2021-04-22 10:31:54 +0300 |
commit | d93592cefa745f4f2503de86ae53e9d90b0e428f (patch) | |
tree | 99af3f531ac9e39a1ace65e6f17f43c0b0fb5ae5 | |
parent | c76d292903fcaf93baf47591604547f3d993ba9c (diff) | |
download | jt2-d93592cefa745f4f2503de86ae53e9d90b0e428f.tar.gz |
refactor: explicitly print error in main, don't return Result
-rw-r--r-- | src/bin/jt2.rs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/bin/jt2.rs b/src/bin/jt2.rs index 8ef0728..a8fe6c1 100644 --- a/src/bin/jt2.rs +++ b/src/bin/jt2.rs @@ -3,7 +3,17 @@ use jt2::opt::{Opt, SubCommand}; use structopt::StructOpt; -fn main() -> anyhow::Result<()> { +fn main() { + match do_work() { + Err(err) => { + eprintln!("ERROR: {:?}", err); + std::process::exit(1); + } + Ok(_) => (), + } +} + +fn do_work() -> anyhow::Result<()> { pretty_env_logger::init_custom_env("JT_LOG"); let opt = Opt::from_args(); let config = Configuration::read(&opt)?; |