From 4383066b9e54df434e2a45fbaeceec3e38a6c7db Mon Sep 17 00:00:00 2001 From: michal Date: Mon, 17 Jan 2022 21:39:17 +0000 Subject: [PATCH] reworked verbosity for existing functions and tweaked regex --- src/internal/clean.rs | 19 ++++++++++++++++--- src/internal/sort.rs | 2 +- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/internal/clean.rs b/src/internal/clean.rs index 46ffe23..5df6056 100644 --- a/src/internal/clean.rs +++ b/src/internal/clean.rs @@ -1,7 +1,7 @@ use regex::Regex; pub fn clean(a: &[String], verbosity: i32) -> Vec { - let r = Regex::new(r"(\S+)((?:>=|<=|>|<|=>|=<)\S+$)").unwrap(); + let r = Regex::new(r"(\S+)((?:>=|<=|>|<)\S+$)").unwrap(); let mut cleaned: Vec = vec![]; @@ -14,8 +14,21 @@ pub fn clean(a: &[String], verbosity: i32) -> Vec { } } - if verbosity >= 1 { - eprintln!("Cleaned {:?}\nInto: {:?}", a, cleaned); + match verbosity { + 0 => {} + 1 => { + eprintln!("Cleaned: {:?}\nInto: {:?}", a, cleaned); + } + _ => { + eprintln!("Cleaned:"); + for b in a { + eprintln!("{}", b); + } + eprintln!("Into:"); + for c in &cleaned { + eprintln!("{}", c); + } + } } cleaned diff --git a/src/internal/sort.rs b/src/internal/sort.rs index 29ab902..4b87157 100644 --- a/src/internal/sort.rs +++ b/src/internal/sort.rs @@ -18,7 +18,7 @@ pub fn sort(input: &[String], verbosity: i32) -> structs::Sorted { _ => { eprintln!("Sorting:"); for b in &a { - eprintln!("{:?}", b); + eprintln!("{}", b); } } }