From 173114a993ecdd9a49f9f54c036cef83abba7ba8 Mon Sep 17 00:00:00 2001 From: Andrew Phillips Date: Fri, 29 Aug 2025 15:37:00 -0300 Subject: [PATCH] feat: add comments to generated config sections Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) --- src/modes/generate_config.rs | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/src/modes/generate_config.rs b/src/modes/generate_config.rs index df8f176..b62774a 100644 --- a/src/modes/generate_config.rs +++ b/src/modes/generate_config.rs @@ -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::>() + .join("\n"); + + println!("{}", commented_yaml); Ok(()) }