added proper cleaning to the sort process + a workaround for me on windows
parent
e7e107bd46
commit
0e7e086f55
@ -0,0 +1,22 @@
|
||||
use regex::Regex;
|
||||
|
||||
pub fn clean(a: &[String], verbosity: i32) -> Vec<String> {
|
||||
let r = Regex::new(r"(\S+)((?:>=|<=|>|<|=>|=<)\S+$)").unwrap();
|
||||
|
||||
let mut cleaned: Vec<String> = vec![];
|
||||
|
||||
for b in a {
|
||||
if r.captures_iter(b).count() > 0 {
|
||||
let c = r.captures(b).unwrap().get(1).map_or("", |m| m.as_str());
|
||||
cleaned.push(c.to_string());
|
||||
} else {
|
||||
cleaned.push(b.to_string());
|
||||
}
|
||||
}
|
||||
|
||||
if verbosity >= 1 {
|
||||
eprintln!("Cleaned {:?}\nInto: {:?}", a, cleaned);
|
||||
}
|
||||
|
||||
cleaned
|
||||
}
|
@ -1,9 +1,12 @@
|
||||
mod clean;
|
||||
pub mod rpc;
|
||||
pub mod structs;
|
||||
mod sort;
|
||||
pub mod structs;
|
||||
|
||||
pub fn sort(a: &[String], verbosity: i32) -> structs::Sorted {
|
||||
sort::sort(a, verbosity)
|
||||
}
|
||||
|
||||
|
||||
pub fn clean(a: &[String], verbosity: i32) -> Vec<String> {
|
||||
clean::clean(a, verbosity)
|
||||
}
|
||||
|
Loading…
Reference in New Issue