feat: Global ignore file flag

This commit is contained in:
Ed Page 2019-07-11 21:56:27 -06:00
parent e6d29070fc
commit 27edfc6e02

View file

@ -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<bool> {
match (self.no_ignore, self.ignore) {
(true, false) => Some(false),
(false, true) => Some(true),
(false, false) => None,
(_, _) => unreachable!("StructOpt should make this impossible"),
}
}
}