From 27edfc6e02213f1392096b13652ad4df4036a0c6 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 11 Jul 2019 21:56:27 -0600 Subject: [PATCH] feat: Global ignore file flag --- src/main.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/main.rs b/src/main.rs index db668a4..2292153 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,6 +55,12 @@ struct Options { #[structopt(long, raw(overrides_with = r#""hidden""#), raw(hidden = "true"))] no_hidden: bool, + #[structopt(long, raw(overrides_with = r#""ignore""#))] + /// Don't respect ignore files. + no_ignore: bool, + #[structopt(long, raw(overrides_with = r#""no-ignore""#), raw(hidden = "true"))] + ignore: bool, + #[structopt(long, raw(overrides_with = r#""ignore-dot""#))] /// Don't respect .ignore files. no_ignore_dot: bool, @@ -87,6 +93,16 @@ impl Options { (false, false) => None, (_, _) => unreachable!("StructOpt should make this impossible"), } + .or_else(|| self.ignore_files()) + } + + fn ignore_files(&self) -> Option { + match (self.no_ignore, self.ignore) { + (true, false) => Some(false), + (false, true) => Some(true), + (false, false) => None, + (_, _) => unreachable!("StructOpt should make this impossible"), + } } }