dejavu/exec/
command_key.rs1pub const NOISE_FLAGS: &[&str] = &[
5 "--color",
6 "--colour",
7 "--no-color",
8 "--no-colour",
9 "--progress",
10 "--no-progress",
11];
12
13pub fn is_noise(arg: &str) -> bool {
14 NOISE_FLAGS
15 .iter()
16 .any(|n| arg == *n || arg.starts_with(&format!("{n}=")))
17}
18
19pub fn drop_noise(args: &[String]) -> Vec<String> {
21 args.iter().filter(|a| !is_noise(a)).cloned().collect()
22}
23
24pub fn command_original(shim: &str, args: &[String]) -> String {
26 if args.is_empty() {
27 shim.to_string()
28 } else {
29 format!("{shim} {}", args.join(" "))
30 }
31}
32
33pub fn build_key(prefix: &str, sig: &[String]) -> String {
36 if sig.is_empty() {
37 format!("{prefix}:default")
38 } else {
39 format!("{prefix}:{}", sig.join(":"))
40 }
41}