nushell/crates/nu_plugin_match/src/match_.rs
Jakub Žádník 28a6a5ea57
Add option to invert match command selection (#3114)
* 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>
2021-03-02 06:48:22 +13:00

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,
})
}
}