blob: a8fe6c181f722bc7103c1f403dee4d6946342885 (
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
28
29
30
|
use jt2::config::Configuration;
use jt2::opt::{Opt, SubCommand};
use structopt::StructOpt;
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)?;
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(())
}
|