diff options
-rw-r--r-- | bin/domain/imag-habit/src/main.rs | 6 | ||||
-rw-r--r-- | bin/domain/imag-timetrack/src/month.rs | 2 | ||||
-rw-r--r-- | bin/domain/imag-timetrack/src/start.rs | 22 | ||||
-rw-r--r-- | lib/entry/libimagentrycategory/src/store.rs | 2 |
4 files changed, 20 insertions, 12 deletions
diff --git a/bin/domain/imag-habit/src/main.rs b/bin/domain/imag-habit/src/main.rs index dc70334e..5c7f8a75 100644 --- a/bin/domain/imag-habit/src/main.rs +++ b/bin/domain/imag-habit/src/main.rs @@ -254,7 +254,11 @@ fn today(rt: &Runtime, future: bool) { let done = scmd.is_present("today-done"); (futu, done) } else { - (true, rt.cli().subcommand_matches("status").unwrap().is_present("status-done")) + if let Some(status) = rt.cli().subcommand_matches("status") { + (true, status.is_present("status-done")) + } else { + (true, false) + } } }; let today = ::chrono::offset::Local::today().naive_local(); diff --git a/bin/domain/imag-timetrack/src/month.rs b/bin/domain/imag-timetrack/src/month.rs index a4028d73..8e9e7f60 100644 --- a/bin/domain/imag-timetrack/src/month.rs +++ b/bin/domain/imag-timetrack/src/month.rs @@ -65,7 +65,7 @@ pub fn month(rt: &Runtime) -> i32 { let (year, month) = if now.month() == 12 { (now.year() + 1, 1) } else { - (now.year(), now.month()) + (now.year(), now.month() + 1) }; NaiveDate::from_ymd(year, month, 1).and_hms(0, 0, 0) diff --git a/bin/domain/imag-timetrack/src/start.rs b/bin/domain/imag-timetrack/src/start.rs index 313c8947..ff440233 100644 --- a/bin/domain/imag-timetrack/src/start.rs +++ b/bin/domain/imag-timetrack/src/start.rs @@ -32,15 +32,19 @@ pub fn start(rt: &Runtime) -> i32 { let (_, cmd) = rt.cli().subcommand(); let cmd = cmd.unwrap(); // checked in main() - let start = match cmd.value_of("start-time") { - None | Some("now") => ::chrono::offset::Local::now().naive_local(), - Some(ndt) => match NaiveDateTime::from_str(ndt).map_err(Error::from) { - Ok(ndt) => ndt, - Err(e) => { - trace_error(&e); - error!("Cannot continue, not having start time"); - return 1 - }, + let start = { + let startstr = cmd.value_of("start-time").unwrap(); // safe by clap + if startstr == "now" { + ::chrono::offset::Local::now().naive_local() + } else { + match NaiveDateTime::from_str(startstr).map_err(Error::from) { + Ok(ndt) => ndt, + Err(e) => { + trace_error(&e); + error!("Cannot continue, not having start time"); + return 1 + }, + } } }; diff --git a/lib/entry/libimagentrycategory/src/store.rs b/lib/entry/libimagentrycategory/src/store.rs index 8a3ba6dc..e05e8230 100644 --- a/lib/entry/libimagentrycategory/src/store.rs +++ b/lib/entry/libimagentrycategory/src/store.rs @@ -223,7 +223,7 @@ fn mk_category_storeid(base: PathBuf, s: &str) -> Result<StoreId> { #[inline] fn represents_category(store: &Store, sid: StoreId, name: &str) -> Result<bool> { - sid.exists() + store.exists(sid.clone()) .context(err_msg("Store id handling error")) .map_err(Error::from) .and_then(|bl| { |