feat: Expose control over .ignore

This commit is contained in:
Ed Page 2019-07-10 20:12:14 -06:00
parent 867c53043b
commit e6d29070fc

View file

@ -54,6 +54,12 @@ struct Options {
hidden: bool, hidden: bool,
#[structopt(long, raw(overrides_with = r#""hidden""#), raw(hidden = "true"))] #[structopt(long, raw(overrides_with = r#""hidden""#), raw(hidden = "true"))]
no_hidden: bool, no_hidden: bool,
#[structopt(long, raw(overrides_with = r#""ignore-dot""#))]
/// Don't respect .ignore files.
no_ignore_dot: bool,
#[structopt(long, raw(overrides_with = r#""no-ignore-dot""#), raw(hidden = "true"))]
ignore_dot: bool,
} }
impl Options { impl Options {
@ -73,6 +79,15 @@ impl Options {
(_, _) => unreachable!("StructOpt should make this impossible"), (_, _) => unreachable!("StructOpt should make this impossible"),
} }
} }
pub fn ignore_dot(&self) -> Option<bool> {
match (self.no_ignore_dot, self.ignore_dot) {
(true, false) => Some(false),
(false, true) => Some(true),
(false, false) => None,
(_, _) => unreachable!("StructOpt should make this impossible"),
}
}
} }
fn run() -> Result<(), failure::Error> { fn run() -> Result<(), failure::Error> {
@ -89,7 +104,8 @@ fn run() -> Result<(), failure::Error> {
walk.add(path); walk.add(path);
} }
walk.threads(options.threads) walk.threads(options.threads)
.hidden(options.ignore_hidden().unwrap_or(true)); .hidden(options.ignore_hidden().unwrap_or(true))
.ignore(options.ignore_dot().unwrap_or(true));
// TODO Add build_parallel for options.threads != 1 // TODO Add build_parallel for options.threads != 1
for entry in walk.build() { for entry in walk.build() {
let entry = entry?; let entry = entry?;