refactor: tags

This commit is contained in:
zhom
2025-08-15 00:55:10 +04:00
parent 88cb154fca
commit fac99f4a51
3 changed files with 102 additions and 41 deletions
+8 -2
View File
@@ -427,8 +427,14 @@ impl ProfileManager {
.find(|p| p.name == profile_name)
.ok_or_else(|| format!("Profile {profile_name} not found"))?;
// Update tags as-is; preserve characters and order given by caller
profile.tags = tags;
let mut seen = std::collections::HashSet::new();
let mut deduped: Vec<String> = Vec::with_capacity(tags.len());
for t in tags.into_iter() {
if seen.insert(t.clone()) {
deduped.push(t);
}
}
profile.tags = deduped;
// Save profile
self.save_profile(&profile)?;