Watch
0
0
Fork
You've already forked hyperhive
0

tool_groups: match names case-insensitively, like capabilities::is_known

This commit is contained in:
damocles 2026-10-08 00:49:17 +02:00 • committed by mara
commit 67fd164dfc

View file

@ -50,12 +50,14 @@ fn read_from(path: &Path) -> std::io::Result<BTreeMap<String, Vec<String>>> {
Ok(map)
}
/// True if `name` matches a recognised [`hive_sh4re::permissions::ToolGroup`]
/// exactly (same comparison [`validate_groups`] uses).
/// True if `name` matches a recognised [`hive_sh4re::permissions::ToolGroup`],
/// case-insensitive (same comparison [`validate_groups`] uses, and the same
/// comparison `capabilities::is_known` uses — a hand-edited `"Meta"` in the
/// file should round-trip, not get pruned).
fn is_known(name: &str) -> bool {
hive_sh4re::permissions::ToolGroup::ALL
.iter()
.any(|g| <&str>::from(*g) == name)
.any(|g| name.eq_ignore_ascii_case(<&str>::from(*g)))
}
/// Drop any tool-group string in `map` that isn't a recognised