feat: add comments to generated config sections

Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
Andrew Phillips
2025-08-29 15:37:00 -03:00
parent 49bd4a8885
commit 173114a993

View File

@@ -154,9 +154,39 @@ pub fn mode_generate_config(_cmd: &mut Command, _settings: &crate::config::Setti
]),
};
// Serialize to YAML and print to stdout
// Serialize to YAML and add comments
let yaml = serde_yaml::to_string(&default_config)?;
println!("{}", yaml);
// Add comments before each top-level section
let commented_yaml = yaml
.lines()
.map(|line| {
if line == "dir: ~/.local/share/keep" {
"# Directory where items are stored\n".to_string() + line
} else if line == "list_format:" {
"\n# Table columns configuration for 'list' command\n".to_string() + line
} else if line == "human_readable: false" {
"\n# Display sizes in human-readable format\n".to_string() + line
} else if line == "output_format: table" {
"\n# Output format: table, json, or yaml\n".to_string() + line
} else if line == "quiet: false" {
"\n# Suppress non-essential output\n".to_string() + line
} else if line == "force: false" {
"\n# Overwrite existing items without confirmation\n".to_string() + line
} else if line == "server:" {
"\n# Server configuration for remote access\n".to_string() + line
} else if line == "compression_plugin: null" {
"\n# Compression plugin configuration\n".to_string() + line
} else if line == "meta_plugins:" {
"\n# Meta plugins configuration\n".to_string() + line
} else {
line.to_string()
}
})
.collect::<Vec<String>>()
.join("\n");
println!("{}", commented_yaml);
Ok(())
}