use jt2::config::Configuration; use jt2::opt::{Opt, SubCommand}; use structopt::StructOpt; fn main() { if let Err(err) = do_work() { eprintln!("ERROR: {:?}", err); std::process::exit(1); } } fn do_work() -> anyhow::Result<()> { pretty_env_logger::init_custom_env("JT_LOG"); let opt = Opt::from_args(); let config = Configuration::read(&opt)?; match opt.cmd { SubCommand::Config(x) => x.run(&config)?, SubCommand::Init(x) => x.run(&config)?, SubCommand::IsJournal(x) => x.run(&config)?, SubCommand::New(x) => x.run(&config)?, SubCommand::NewTopic(x) => x.run(&config)?, SubCommand::Edit(x) => x.run(&config)?, SubCommand::Finish(x) => x.run(&config)?, } Ok(()) }