Use the get_table util to extract "[all]" table

I built the function for this purpose and then forgot to use it. I
remembered after doing the per-project bit, so here's the refactor.
This commit is contained in:
2025-07-17 11:49:44 -05:00
parent 5ce20adf2e
commit 28539f54cc

View File

@@ -54,8 +54,7 @@ fn lconf(text: &str) -> Result<WholeFile> {
let cfg_table = toml_val.as_table().ok_or(Error::BadFormat)?;
// Get the global config out of the file
if let Some(section_all) = cfg_table.get("all") {
if let Some(table_all) = section_all.as_table() {
let table_all = get_table(cfg_table, "all")?;
whole.all = PartialConfig {
project_path: None, // There is no global project path. That's nonsense.
gitea_url: get_maybe_property(&table_all, "gitea_url")?.cloned(),
@@ -63,8 +62,6 @@ fn lconf(text: &str) -> Result<WholeFile> {
repo: get_maybe_property(&table_all, "repo")?.cloned(),
token: get_maybe_property(&table_all, "token")?.cloned(),
};
}
}
// Loop over the per-project configs, if any.
let per_project_keys = cfg_table