mirror of
https://github.com/crate-ci/typos.git
synced 2024-11-25 10:31:02 -05:00
feat(ddi): Allow controlling 'unicode' via args
This commit is contained in:
parent
6146824b4e
commit
92a1172bfa
2 changed files with 15 additions and 2 deletions
|
@ -23,7 +23,7 @@ Configuration is read from the following (in precedence order)
|
||||||
| default.binary | --binary | bool | Check binary files as text |
|
| default.binary | --binary | bool | Check binary files as text |
|
||||||
| default.check-filename | \- | bool | Verifying spelling in file names. |
|
| default.check-filename | \- | bool | Verifying spelling in file names. |
|
||||||
| default.check-file | \- | bool | Verifying spelling in files. |
|
| default.check-file | \- | bool | Verifying spelling in files. |
|
||||||
| default.unicode | \- | bool | Allow unicode characters in identifiers (and not just ASCII) |
|
| default.unicode | --unicode | bool | Allow unicode characters in identifiers (and not just ASCII) |
|
||||||
| default.ignore-hex | \- | bool | Do not check identifiers that appear to be hexadecimal values. |
|
| default.ignore-hex | \- | bool | Do not check identifiers that appear to be hexadecimal values. |
|
||||||
| default.identifier-leading-digits | \- | bool | Allow identifiers to start with digits, in addition to letters. |
|
| default.identifier-leading-digits | \- | bool | Allow identifiers to start with digits, in addition to letters. |
|
||||||
| default.locale | --locale | en, en-us, en-gb, en-ca, en-au | English dialect to correct to. |
|
| default.locale | --locale | en, en-us, en-gb, en-ca, en-au | English dialect to correct to. |
|
||||||
|
|
15
src/args.rs
15
src/args.rs
|
@ -123,6 +123,12 @@ pub(crate) struct FileArgs {
|
||||||
#[structopt(long, overrides_with("no-check-files"), hidden(true))]
|
#[structopt(long, overrides_with("no-check-files"), hidden(true))]
|
||||||
check_files: bool,
|
check_files: bool,
|
||||||
|
|
||||||
|
#[structopt(long, overrides_with("no-unicode"), hidden(true))]
|
||||||
|
unicode: bool,
|
||||||
|
#[structopt(long, overrides_with("unicode"))]
|
||||||
|
/// Only allow ASCII characters in identifiers
|
||||||
|
no_unicode: bool,
|
||||||
|
|
||||||
#[structopt(
|
#[structopt(
|
||||||
long,
|
long,
|
||||||
possible_values(&config::Locale::variants()),
|
possible_values(&config::Locale::variants()),
|
||||||
|
@ -136,7 +142,10 @@ impl FileArgs {
|
||||||
binary: self.binary(),
|
binary: self.binary(),
|
||||||
check_filename: self.check_filename(),
|
check_filename: self.check_filename(),
|
||||||
check_file: self.check_file(),
|
check_file: self.check_file(),
|
||||||
tokenizer: None,
|
tokenizer: Some(config::TokenizerConfig {
|
||||||
|
unicode: self.unicode(),
|
||||||
|
..Default::default()
|
||||||
|
}),
|
||||||
dict: Some(config::DictConfig {
|
dict: Some(config::DictConfig {
|
||||||
locale: self.locale,
|
locale: self.locale,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
@ -152,6 +161,10 @@ impl FileArgs {
|
||||||
resolve_bool_arg(self.check_filenames, self.no_check_filenames)
|
resolve_bool_arg(self.check_filenames, self.no_check_filenames)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn unicode(&self) -> Option<bool> {
|
||||||
|
resolve_bool_arg(self.unicode, self.no_unicode)
|
||||||
|
}
|
||||||
|
|
||||||
fn check_file(&self) -> Option<bool> {
|
fn check_file(&self) -> Option<bool> {
|
||||||
resolve_bool_arg(self.check_files, self.no_check_files)
|
resolve_bool_arg(self.check_files, self.no_check_files)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue