mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2026-05-26 20:49:55 +00:00
fix: Add option to mark certain config sections as optional
Fixes #1290
This commit is contained in:
@@ -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");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user