Fix: "status" subcommand might not be present

If we call 'imag-habit' without a subcommand, we assume "today". Thus it
might occur that the "status" subcommand match is not present, hence we
have to assume `false` here as default value.

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2019-02-06 01:54:47 +01:00
parent e25cf17a8a
commit 84aef82258
1 changed files with 5 additions and 1 deletions

View File

@ -254,7 +254,11 @@ fn today(rt: &Runtime, future: bool) {
let done = scmd.is_present("today-done");
(futu, done)
} else {
(true, rt.cli().subcommand_matches("status").unwrap().is_present("status-done"))
if let Some(status) = rt.cli().subcommand_matches("status") {
(true, status.is_present("status-done"))
} else {
(true, false)
}
}
};
let today = ::chrono::offset::Local::today().naive_local();