Skip to content

Commit

Permalink
feat: Global ignore file flag
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Jul 12, 2019
1 parent e6d2907 commit 27edfc6
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"),
}
}
}

Expand Down

0 comments on commit 27edfc6

Please sign in to comment.