keep the order of keys in config.yaml (#5468)

This commit is contained in:
Jack Amadeo
2025-10-30 17:58:44 -04:00
committed by GitHub
parent e586e13d9d
commit 65644ed81f
9 changed files with 141 additions and 166 deletions
+13 -17
View File
@@ -40,26 +40,22 @@ pub fn handle_info(verbose: bool) -> Result<()> {
// Print verbose info if requested
if verbose {
println!("\n{}", style("goose Configuration:").cyan().bold());
match config.load_values() {
Ok(values) => {
if values.is_empty() {
println!(" No configuration values set");
println!(
" Run '{}' to configure goose",
style("goose configure").cyan()
);
} else {
let sorted_values: std::collections::BTreeMap<_, _> =
values.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
let values = config.all_values()?;
if values.is_empty() {
println!(" No configuration values set");
println!(
" Run '{}' to configure goose",
style("goose configure").cyan()
);
} else {
let sorted_values: std::collections::BTreeMap<_, _> =
values.iter().map(|(k, v)| (k.clone(), v.clone())).collect();
if let Ok(yaml) = serde_yaml::to_string(&sorted_values) {
for line in yaml.lines() {
println!(" {}", line);
}
}
if let Ok(yaml) = serde_yaml::to_string(&sorted_values) {
for line in yaml.lines() {
println!(" {}", line);
}
}
Err(e) => println!(" Error loading configuration: {}", e),
}
}