diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2019-02-06 01:54:47 +0100 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2019-02-09 01:03:34 +0100 |
commit | 84aef822588f75702a7779286d694761abe1469e (patch) | |
tree | 1ed9011972460009ac70b4bf6cbe2ba81fad8eea | |
parent | e25cf17a8a8bda3c4532fe9316b92a94a3158fe7 (diff) |
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>
-rw-r--r-- | bin/domain/imag-habit/src/main.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/domain/imag-habit/src/main.rs b/bin/domain/imag-habit/src/main.rs index dc70334e..5c7f8a75 100644 --- a/bin/domain/imag-habit/src/main.rs +++ b/bin/domain/imag-habit/src/main.rs @@ -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(); |