refactor( Push out options

This commit is contained in:
Ed Page 2019-08-07 10:32:53 -05:00
parent 87015d3522
commit f9a1600513

View file

@ -262,21 +262,16 @@ fn run() -> Result<i32, failure::Error> {
let mut builder = get_logging(options.verbose.log_level()); let mut builder = get_logging(options.verbose.log_level());
builder.init(); builder.init();
let check_filenames = options.check_filenames().unwrap_or(true);
let check_files = options.check_files().unwrap_or(true);
let ignore_hex = options.ignore_hex().unwrap_or(true);
let binary = options.binary().unwrap_or(false);
let dictionary = typos::BuiltIn::new(); let dictionary = typos::BuiltIn::new();
let parser = typos::tokens::ParserBuilder::new() let parser = typos::tokens::ParserBuilder::new()
.ignore_hex(ignore_hex) .ignore_hex(options.ignore_hex().unwrap_or(true))
.build(); .build();
let checks = typos::checks::CheckSettings::new() let checks = typos::checks::CheckSettings::new()
.check_filenames(check_filenames) .check_filenames(options.check_filenames().unwrap_or(true))
.check_files(check_files) .check_files(options.check_files().unwrap_or(true))
.binary(binary) .binary(options.binary().unwrap_or(false))
.build(&dictionary, &parser); .build(&dictionary, &parser);
let mut config = config::Config::default(); let mut config = config::Config::default();