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:
parent
afe275692e
commit
340dab18f0
1 changed files with 13 additions and 9 deletions
|
@ -32,15 +32,19 @@ pub fn start(rt: &Runtime) -> i32 {
|
||||||
let (_, cmd) = rt.cli().subcommand();
|
let (_, cmd) = rt.cli().subcommand();
|
||||||
let cmd = cmd.unwrap(); // checked in main()
|
let cmd = cmd.unwrap(); // checked in main()
|
||||||
|
|
||||||
let start = match cmd.value_of("start-time") {
|
let start = {
|
||||||
None | Some("now") => ::chrono::offset::Local::now().naive_local(),
|
let startstr = cmd.value_of("start-time").unwrap(); // safe by clap
|
||||||
Some(ndt) => match NaiveDateTime::from_str(ndt).map_err(Error::from) {
|
if startstr == "now" {
|
||||||
Ok(ndt) => ndt,
|
::chrono::offset::Local::now().naive_local()
|
||||||
Err(e) => {
|
} else {
|
||||||
trace_error(&e);
|
match NaiveDateTime::from_str(startstr).map_err(Error::from) {
|
||||||
error!("Cannot continue, not having start time");
|
Ok(ndt) => ndt,
|
||||||
return 1
|
Err(e) => {
|
||||||
},
|
trace_error(&e);
|
||||||
|
error!("Cannot continue, not having start time");
|
||||||
|
return 1
|
||||||
|
},
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue