Fix order of evaluation

We need to evaluate the commandline argument first and if there is none,
we use the default.

This patch fixes that bug.
This commit is contained in:
Matthias Beyer 2018-02-20 17:27:42 +01:00
parent 912a48cbfe
commit 0cde88d661
1 changed files with 4 additions and 2 deletions

View File

@ -26,8 +26,10 @@ use toml_query::read::TomlValueReadExt;
pub fn get_diary_name(rt: &Runtime) -> Option<String> {
use libimagdiary::config::get_default_diary_name;
get_default_diary_name(rt)
.or(rt.cli().value_of("diaryname").map(String::from))
rt.cli()
.value_of("diaryname")
.map(String::from)
.or_else(|| get_default_diary_name(rt))
}
pub enum Timed {