fix: Add option to mark certain config sections as optional

Fixes #1290
This commit is contained in:
Jade Ellis
2026-01-20 17:36:22 +00:00
parent 59346fc766
commit c85e710760
4 changed files with 20 additions and 7 deletions
+7 -1
View File
@@ -73,7 +73,13 @@ fn generate_example(input: &ItemStruct, args: &[Meta], write: bool) -> Result<To
.expect("written to config file");
}
file.write_fmt(format_args!("\n[{section}]\n"))
let optional = settings.get("optional").is_some_and(|v| v == "true");
let section_header = if optional {
format!("\n#[{section}]\n")
} else {
format!("\n[{section}]\n")
};
file.write_fmt(format_args!("{section_header}"))
.expect("written to config file");
}