Skip to content

Commit

Permalink
feat: Expose control over .ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 11, 2019
1 parent 867c530 commit e6d2907
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ struct Options {
hidden: bool,
#[structopt(long, raw(overrides_with = r#""hidden""#), raw(hidden = "true"))]
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 {
Expand All @@ -73,6 +79,15 @@ impl Options {
(_, _) => 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> {
Expand All @@ -89,7 +104,8 @@ fn run() -> Result<(), failure::Error> {
walk.add(path);
}
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
for entry in walk.build() {
let entry = entry?;
Expand Down

0 comments on commit e6d2907

Please sign in to comment.