Merge commit '918acafef6
' into sync_cg_clif-2025-01-05
This commit is contained in:
commit
a94e2d513b
16 changed files with 119 additions and 248 deletions
|
@ -33,23 +33,3 @@ pub(crate) fn get_bool(name: &str) -> bool {
|
|||
true
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn get_value(name: &str) -> Option<String> {
|
||||
let values = load_config_file()
|
||||
.into_iter()
|
||||
.filter(|(key, _)| key == name)
|
||||
.map(|(_, val)| val)
|
||||
.collect::<Vec<_>>();
|
||||
if values.is_empty() {
|
||||
None
|
||||
} else if values.len() == 1 {
|
||||
if values[0].is_none() {
|
||||
eprintln!("Config `{}` missing value", name);
|
||||
process::exit(1);
|
||||
}
|
||||
values.into_iter().next().unwrap()
|
||||
} else {
|
||||
eprintln!("Config `{}` given multiple values: {:?}", name, values);
|
||||
process::exit(1);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue