1 macro_rules! w { 2 ($buf:expr, $to_w:expr) => { 3 match $buf.write_all($to_w) { 4 Ok(..) => (), 5 Err(..) => panic!("Failed to write to completions file"), 6 } 7 }; 8 } 9 10 macro_rules! get_zsh_arg_conflicts { 11 ($p:ident, $arg:ident, $msg:ident) => { 12 if let Some(conf_vec) = $arg.blacklist() { 13 let mut v = vec![]; 14 for arg_name in conf_vec { 15 let arg = $p.find_any_arg(arg_name).expect($msg); 16 if let Some(s) = arg.short() { 17 v.push(format!("-{}", s)); 18 } 19 if let Some(l) = arg.long() { 20 v.push(format!("--{}", l)); 21 } 22 } 23 v.join(" ") 24 } else { 25 String::new() 26 } 27 }; 28 } 29