Keygen grind fix and improve --ignore-case (#6901)

* keygen: grind --ignore-case was not honored

* keygen: Improve grind --ignore-case ergonomics

Don't silently require the user to know their search term needs to be lowercase

* fmt
This commit is contained in:
Trent Nelson 2019-11-12 14:24:37 -07:00 committed by Michael Vines
parent 5a629ff387
commit 71bf8c5f85
1 changed files with 3 additions and 1 deletions

View File

@ -237,10 +237,11 @@ fn main() -> Result<(), Box<dyn error::Error>> {
output_keypair(&keypair, &outfile, "recovered")?;
}
("grind", Some(matches)) => {
let ignore_case = matches.is_present("ignore-case");
let ignore_case = matches.is_present("ignore_case");
let includes = if matches.is_present("includes") {
values_t_or_exit!(matches, "includes", String)
.into_iter()
.map(|s| if ignore_case { s.to_lowercase() } else { s })
.collect()
} else {
HashSet::new()
@ -249,6 +250,7 @@ fn main() -> Result<(), Box<dyn error::Error>> {
let starts_with = if matches.is_present("starts_with") {
values_t_or_exit!(matches, "starts_with", String)
.into_iter()
.map(|s| if ignore_case { s.to_lowercase() } else { s })
.collect()
} else {
HashSet::new()