From 1d1ac49d0be24f12d0594efdf0e7db95c445dd36 Mon Sep 17 00:00:00 2001 From: kjuulh Date: Sat, 9 Mar 2024 21:08:16 +0100 Subject: [PATCH] feat: prefer first variable Signed-off-by: kjuulh --- cuddle/src/cli/subcommands/folder.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cuddle/src/cli/subcommands/folder.rs b/cuddle/src/cli/subcommands/folder.rs index c13a6d1..a67e2f2 100644 --- a/cuddle/src/cli/subcommands/folder.rs +++ b/cuddle/src/cli/subcommands/folder.rs @@ -151,12 +151,12 @@ fn filter_by_prefix(variables: Vec) -> impl Function { }) .collect::>(); - tracing::info!("was here"); - let mut structure: HashMap = HashMap::new(); for var in vars { - tracing::info!("found: {} - {}", &var.name, &var.value); - structure.insert(var.name, var.value); + if !structure.contains_key(&var.name) { + tracing::info!("found: {} - {}", &var.name, &var.value); + structure.insert(var.name, var.value); + } } Ok(serde_json::to_value(structure).unwrap())