Struct grep_cli::DecompressionMatcherBuilder
source · pub struct DecompressionMatcherBuilder { /* private fields */ }
Expand description
A builder for a matcher that determines which files get decompressed.
Implementations§
source§impl DecompressionMatcherBuilder
impl DecompressionMatcherBuilder
sourcepub fn new() -> DecompressionMatcherBuilder
pub fn new() -> DecompressionMatcherBuilder
Create a new builder for configuring a decompression matcher.
sourcepub fn build(&self) -> Result<DecompressionMatcher, CommandError>
pub fn build(&self) -> Result<DecompressionMatcher, CommandError>
Build a matcher for determining how to decompress files.
If there was a problem compiling the matcher, then an error is returned.
sourcepub fn defaults(&mut self, yes: bool) -> &mut DecompressionMatcherBuilder
pub fn defaults(&mut self, yes: bool) -> &mut DecompressionMatcherBuilder
When enabled, the default matching rules will be compiled into this matcher before any other associations. When disabled, only the rules explicitly given to this builder will be used.
This is enabled by default.
sourcepub fn associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I
) -> &mut DecompressionMatcherBuilderwhere
P: AsRef<OsStr>,
I: IntoIterator<Item = A>,
A: AsRef<OsStr>,
pub fn associate<P, I, A>( &mut self, glob: &str, program: P, args: I ) -> &mut DecompressionMatcherBuilderwhere P: AsRef<OsStr>, I: IntoIterator<Item = A>, A: AsRef<OsStr>,
Associates a glob with a command to decompress files matching the glob.
If multiple globs match the same file, then the most recently added glob takes precedence.
The syntax for the glob is documented in the
globset
crate.
The program
given is resolved with respect to PATH
and turned
into an absolute path internally before being executed by the current
platform. Notably, on Windows, this avoids a security problem where
passing a relative path to CreateProcess
will automatically search
the current directory for a matching program. If the program could
not be resolved, then it is silently ignored and the association is
dropped. For this reason, callers should prefer try_associate
.
sourcepub fn try_associate<P, I, A>(
&mut self,
glob: &str,
program: P,
args: I
) -> Result<&mut DecompressionMatcherBuilder, CommandError>where
P: AsRef<OsStr>,
I: IntoIterator<Item = A>,
A: AsRef<OsStr>,
pub fn try_associate<P, I, A>( &mut self, glob: &str, program: P, args: I ) -> Result<&mut DecompressionMatcherBuilder, CommandError>where P: AsRef<OsStr>, I: IntoIterator<Item = A>, A: AsRef<OsStr>,
Associates a glob with a command to decompress files matching the glob.
If multiple globs match the same file, then the most recently added glob takes precedence.
The syntax for the glob is documented in the
globset
crate.
The program
given is resolved with respect to PATH
and turned
into an absolute path internally before being executed by the current
platform. Notably, on Windows, this avoids a security problem where
passing a relative path to CreateProcess
will automatically search
the current directory for a matching program. If the program could not
be resolved, then an error is returned.
Trait Implementations§
source§impl Clone for DecompressionMatcherBuilder
impl Clone for DecompressionMatcherBuilder
source§fn clone(&self) -> DecompressionMatcherBuilder
fn clone(&self) -> DecompressionMatcherBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more