Add basic gitignore functionality
No support for wildcards and exact matches might screw up nested directories. The Globbing functionality seems like its going to be a pain to properly match up.
This commit is contained in:
@@ -6,6 +6,7 @@ pub struct Config {
|
||||
pub pattern: String,
|
||||
pub ignore_case: bool,
|
||||
pub path: String,
|
||||
pub use_gitignore: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -28,7 +29,12 @@ impl Config {
|
||||
Arg::with_name("path")
|
||||
.help("Path to search in")
|
||||
.index(2)
|
||||
.default_value("."),
|
||||
.default_value(""),
|
||||
)
|
||||
.arg(
|
||||
Arg::with_name("gitignore")
|
||||
.long("no-gitignore")
|
||||
.help("Include results that are specified in .gitignore"),
|
||||
)
|
||||
.get_matches();
|
||||
|
||||
@@ -36,6 +42,7 @@ impl Config {
|
||||
pattern: String::from(matches.value_of("pattern").unwrap()),
|
||||
ignore_case: matches.is_present("ignore case"),
|
||||
path: String::from(matches.value_of("path").unwrap()),
|
||||
use_gitignore: !matches.is_present("gitignore"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user