summaryrefslogtreecommitdiff
path: root/src/bin/jt2.rs
blob: 8ef0728ab83aad13ecc7e71d477ba2d27a706309 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use jt2::config::Configuration;
use jt2::opt::{Opt, SubCommand};

use structopt::StructOpt;

fn main() -> 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(())
}