From e6d29070fc735667e600c16b52b31a4da7222f39 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Wed, 10 Jul 2019 20:12:14 -0600 Subject: [PATCH] feat: Expose control over .ignore --- src/main.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index af2201d..db668a4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 { @@ -73,6 +79,15 @@ impl Options { (_, _) => unreachable!("StructOpt should make this impossible"), } } + + pub fn ignore_dot(&self) -> Option { + 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> { @@ -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?;