blob: 1574f2e4ddae3b176fbf7dcf971eb9392f4cc4c0 (
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
|
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::List(x) => x.run(&config)?,
SubCommand::Edit(x) => x.run(&config)?,
SubCommand::Finish(x) => x.run(&config)?,
}
Ok(())
}
|