feat: comment out all lines in generated config

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:39:06 -03:00
parent 173114a993
commit 7311988d4a

View File

@@ -154,33 +154,17 @@ pub fn mode_generate_config(_cmd: &mut Command, _settings: &crate::config::Setti
]), ]),
}; };
// Serialize to YAML and add comments // Serialize to YAML and comment out all lines
let yaml = serde_yaml::to_string(&default_config)?; let yaml = serde_yaml::to_string(&default_config)?;
// Add comments before each top-level section // Comment out every line
let commented_yaml = yaml let commented_yaml = yaml
.lines() .lines()
.map(|line| { .map(|line| {
if line == "dir: ~/.local/share/keep" { if line.trim().is_empty() {
"# 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() line.to_string()
} else {
format!("# {}", line)
} }
}) })
.collect::<Vec<String>>() .collect::<Vec<String>>()