From ed1276c7008b1dab96cd6b73e4b0fb62ca58bcc0 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 24 Aug 2021 10:44:14 +0300 Subject: feat! rename binary from jt2 to jt The software has now replaced all my use of the old Python version. Sponsored-by: author --- src/bin/jt.rs | 29 +++++++++++++++++++++++++++++ src/bin/jt2.rs | 29 ----------------------------- src/config.rs | 2 +- 3 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 src/bin/jt.rs delete mode 100644 src/bin/jt2.rs (limited to 'src') diff --git a/src/bin/jt.rs b/src/bin/jt.rs new file mode 100644 index 0000000..11fc45d --- /dev/null +++ b/src/bin/jt.rs @@ -0,0 +1,29 @@ +use jt::config::Configuration; +use jt::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::Remove(x) => x.run(&config)?, + SubCommand::Finish(x) => x.run(&config)?, + } + Ok(()) +} diff --git a/src/bin/jt2.rs b/src/bin/jt2.rs deleted file mode 100644 index a5760d8..0000000 --- a/src/bin/jt2.rs +++ /dev/null @@ -1,29 +0,0 @@ -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::Remove(x) => x.run(&config)?, - SubCommand::Finish(x) => x.run(&config)?, - } - Ok(()) -} diff --git a/src/config.rs b/src/config.rs index 655b835..03b54ce 100644 --- a/src/config.rs +++ b/src/config.rs @@ -8,7 +8,7 @@ use serde::Deserialize; use std::default::Default; use std::path::{Path, PathBuf}; -const APP: &str = "jt2"; +const APP: &str = "jt"; // The configuration file we read. // -- cgit v1.2.1