mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
feat: Expose control over .ignore
This commit is contained in:
parent
867c53043b
commit
e6d29070fc
1 changed files with 17 additions and 1 deletions
18
src/main.rs
18
src/main.rs
|
@ -54,6 +54,12 @@ struct Options {
|
||||||
hidden: bool,
|
hidden: bool,
|
||||||
#[structopt(long, raw(overrides_with = r#""hidden""#), raw(hidden = "true"))]
|
#[structopt(long, raw(overrides_with = r#""hidden""#), raw(hidden = "true"))]
|
||||||
no_hidden: bool,
|
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 {
|
impl Options {
|
||||||
|
@ -73,6 +79,15 @@ impl Options {
|
||||||
(_, _) => unreachable!("StructOpt should make this impossible"),
|
(_, _) => unreachable!("StructOpt should make this impossible"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn ignore_dot(&self) -> Option<bool> {
|
||||||
|
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> {
|
fn run() -> Result<(), failure::Error> {
|
||||||
|
@ -89,7 +104,8 @@ fn run() -> Result<(), failure::Error> {
|
||||||
walk.add(path);
|
walk.add(path);
|
||||||
}
|
}
|
||||||
walk.threads(options.threads)
|
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
|
// TODO Add build_parallel for options.threads != 1
|
||||||
for entry in walk.build() {
|
for entry in walk.build() {
|
||||||
let entry = entry?;
|
let entry = entry?;
|
||||||
|
|
Loading…
Reference in a new issue