Merge pull request #609 from epage/locale

fix(cli): Don't crash on --locale
This commit is contained in:
Ed Page 2022-11-03 22:26:55 -05:00 committed by GitHub
commit 6c856a008b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,3 +1,4 @@
use clap::builder::TypedValueParser;
use clap::Parser; use clap::Parser;
use typos_cli::config; use typos_cli::config;
@ -129,7 +130,11 @@ pub(crate) struct FileArgs {
/// Only allow ASCII characters in identifiers /// Only allow ASCII characters in identifiers
no_unicode: bool, no_unicode: bool,
#[arg(long, value_parser = clap::builder::PossibleValuesParser::new(config::Locale::variants()))] #[arg(long)]
#[arg(
value_parser = clap::builder::PossibleValuesParser::new(config::Locale::variants())
.map(|l| l.parse::<config::Locale>().unwrap())
)]
pub(crate) locale: Option<config::Locale>, pub(crate) locale: Option<config::Locale>,
} }