mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 02:20:58 -05:00
feat: Global ignore file flag
This commit is contained in:
parent
e6d29070fc
commit
27edfc6e02
1 changed files with 16 additions and 0 deletions
16
src/main.rs
16
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<bool> {
|
||||
match (self.no_ignore, self.ignore) {
|
||||
(true, false) => Some(false),
|
||||
(false, true) => Some(true),
|
||||
(false, false) => None,
|
||||
(_, _) => unreachable!("StructOpt should make this impossible"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue