From 284f12e8cb2503915ab9040d674f9c3bb72ec82c Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Sat, 13 Jan 2018 14:31:24 +0100 Subject: [PATCH] Refactor: Split actual list implementation from argument processing --- bin/domain/imag-timetrack/src/list.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/domain/imag-timetrack/src/list.rs b/bin/domain/imag-timetrack/src/list.rs index 109a7ae6..88c61504 100644 --- a/bin/domain/imag-timetrack/src/list.rs +++ b/bin/domain/imag-timetrack/src/list.rs @@ -19,6 +19,7 @@ use std::str::FromStr; +use chrono::NaiveDateTime; use filters::filter::Filter; use libimagerror::trace::trace_error; @@ -53,6 +54,16 @@ pub fn list(rt: &Runtime) -> i32 { let list_not_ended = cmd.is_present("list-not-ended"); + list_impl(rt, start, end, list_not_ended) +} + +pub fn list_impl(rt: &Runtime, + start: Option, + end: Option, + list_not_ended: bool) + -> i32 +{ + let start_time_filter = |timetracking: &FileLockEntry| { start.map(|s| match timetracking.get_start_datetime() { Ok(Some(dt)) => dt >= s,