Refactor: Split actual list implementation from argument processing
This commit is contained in:
parent
184a6882b7
commit
284f12e8cb
1 changed files with 11 additions and 0 deletions
|
@ -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<NaiveDateTime>,
|
||||
end: Option<NaiveDateTime>,
|
||||
list_not_ended: bool)
|
||||
-> i32
|
||||
{
|
||||
|
||||
let start_time_filter = |timetracking: &FileLockEntry| {
|
||||
start.map(|s| match timetracking.get_start_datetime() {
|
||||
Ok(Some(dt)) => dt >= s,
|
||||
|
|
Loading…
Reference in a new issue