blob: c37b7990273cb2df4c4615e67b5536e84b85fb07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
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(())
}
|