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 = 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) {
|
||||
Ok(ndt) => ndt,
|
||||
Err(e) => {
|
||||
trace_error(&e);
|
||||
error!("Cannot continue, not having start time");
|
||||
return 1
|
||||
},
|
||||
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);
|
||||
error!("Cannot continue, not having start time");
|
||||
return 1
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue