mirror of
https://github.com/nushell/nushell
synced 2025-01-05 01:39:02 +00:00
28a6a5ea57
* Add option to invert match command selection * Fix rustfmt error * Rename match --exclude to --invert To be more descriptive and conform to e.g. grep or ripgrep -v flag. Also simplified the --invert flag description. * Fix formatting when description got shorter Co-authored-by: Jakub Žádník <jakub.zadnik@tuni.fi>
18 lines
357 B
Rust
18 lines
357 B
Rust
use regex::Regex;
|
|
|
|
pub struct Match {
|
|
pub column: String,
|
|
pub regex: Regex,
|
|
pub invert: bool,
|
|
}
|
|
|
|
impl Match {
|
|
#[allow(clippy::trivial_regex)]
|
|
pub fn new() -> Result<Self, Box<dyn std::error::Error>> {
|
|
Ok(Match {
|
|
column: String::new(),
|
|
regex: Regex::new("")?,
|
|
invert: false,
|
|
})
|
|
}
|
|
}
|