summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-01-15 13:01:25 +0100
committerGitHub <noreply@github.com>2018-01-15 13:01:25 +0100
commit2b0dfec4578f43330414523f0c86dd2f827b1002 (patch)
tree7f9b16088c0b424784259eaf1039047c2ecc547d
parent184a6882b7206d0f849d54ffc38392ff4c4cdd77 (diff)
parent5beadbbf5b03c3e5a48a54f592ab067605a8d038 (diff)
downloadimag-2b0dfec4578f43330414523f0c86dd2f827b1002.zip
imag-2b0dfec4578f43330414523f0c86dd2f827b1002.tar.gz
Merge pull request #1218 from matthiasbeyer/imag-timetrack/default-command
imag-timetrack: default command
-rw-r--r--bin/domain/imag-timetrack/src/list.rs11
-rw-r--r--bin/domain/imag-timetrack/src/main.rs7
2 files changed, 15 insertions, 3 deletions
diff --git a/bin/domain/imag-timetrack/src/list.rs b/bin/domain/imag-timetrack/src/list.rs
index 109a7ae..88c6150 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<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,
diff --git a/bin/domain/imag-timetrack/src/main.rs b/bin/domain/imag-timetrack/src/main.rs
index cdfd979..55a8d01 100644
--- a/bin/domain/imag-timetrack/src/main.rs
+++ b/bin/domain/imag-timetrack/src/main.rs
@@ -45,7 +45,7 @@ mod year;
use cont::cont;
use day::day;
-use list::list;
+use list::{list, list_impl};
use month::month;
use start::start;
use stop::stop;
@@ -81,8 +81,9 @@ fn main() {
},
}
} else {
- error!("No command");
- 1
+ let start = ::chrono::offset::Local::today().naive_local().and_hms(0, 0, 0);
+ let end = ::chrono::offset::Local::today().naive_local().and_hms(23, 59, 59);
+ list_impl(&rt, Some(start), Some(end), false)
};
::std::process::exit(retval);