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"), + } } }