Fix: 'start-time' cannot be None

The UI is configured to require the 'start-time' parameter, so we do not
need to check for None here.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-02-06 01:38:26 +01:00
parent afe275692e
commit 340dab18f0

View file

@ -32,9 +32,12 @@ 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) {
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);
@ -42,6 +45,7 @@ pub fn start(rt: &Runtime) -> i32 {
return 1
},
}
}
};
cmd.values_of("tags")