Omit files and print only match options added
These are essential for using the tool for scripting purposes.
This commit is contained in:
@@ -7,6 +7,8 @@ pub struct Config {
|
||||
pub ignore_case: bool,
|
||||
pub path: String,
|
||||
pub use_gitignore: bool,
|
||||
pub omit_filenames: bool,
|
||||
pub match_only: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -36,6 +38,16 @@ impl Config {
|
||||
.long("no-gitignore")
|
||||
.help("Include results that are specified in .gitignore"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("omit filenames")
|
||||
.short("h")
|
||||
.help("Omit file names in results"),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("only match")
|
||||
.short("o")
|
||||
.help("Only print matched text")
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
Config {
|
||||
@@ -43,6 +55,8 @@ impl Config {
|
||||
ignore_case: matches.is_present("ignore case"),
|
||||
path: String::from(matches.value_of("path").unwrap()),
|
||||
use_gitignore: !matches.is_present("gitignore"),
|
||||
omit_filenames: matches.is_present("omit filenames"),
|
||||
match_only: matches.is_present("only match"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user