pub const NOISE_FLAGS: &[&str] = &[
"--color",
"--colour",
"--no-color",
"--no-colour",
"--progress",
"--no-progress",
];
pub fn is_noise(arg: &str) -> bool {
NOISE_FLAGS
.iter()
.any(|n| arg == *n || arg.starts_with(&format!("{n}=")))
}
pub fn drop_noise(args: &[String]) -> Vec<String> {
args.iter().filter(|a| !is_noise(a)).cloned().collect()
}
pub fn command_original(shim: &str, args: &[String]) -> String {
if args.is_empty() {
shim.to_string()
} else {
format!("{shim} {}", args.join(" "))
}
}
pub fn build_key(prefix: &str, sig: &[String]) -> String {
if sig.is_empty() {
format!("{prefix}:default")
} else {
format!("{prefix}:{}", sig.join(":"))
}
}