pub fn user_tags(tags: &BTreeMap<String, String>) -> BTreeMap<String, String>Expand description
Strip kopia’s tag: manifest-key prefix from a snapshot tags map, yielding the
tags under the keys the CLI was given (--tags key:value → manifest tag:key).
kopia splits each --tags argument on the FIRST colon and stores the key with a
tag: prefix in the manifest (verified against the pinned 0.23.1 binary by
integration_roundtrip::tag_mechanics_...). Keys without the prefix are kept
verbatim, so a kopia release that dropped the prefix would degrade gracefully
instead of hiding every tag.
use std::collections::BTreeMap;
let mut m = BTreeMap::new();
m.insert("tag:kopiur-meta".to_string(), "{\"schema\":1}".to_string());
m.insert("bare".to_string(), "kept".to_string());
let u = kopiur_kopia::user_tags(&m);
assert_eq!(u.get("kopiur-meta").map(String::as_str), Some("{\"schema\":1}"));
assert_eq!(u.get("bare").map(String::as_str), Some("kept"));