From f71f83b4393cb26c37c889a87b351225aa0e5501 Mon Sep 17 00:00:00 2001 From: Ed Page Date: Thu, 3 Nov 2022 22:08:04 -0500 Subject: [PATCH] fix(cli): Don't crash on --locale --- src/bin/typos-cli/args.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/bin/typos-cli/args.rs b/src/bin/typos-cli/args.rs index 5c5a713..3d812e4 100644 --- a/src/bin/typos-cli/args.rs +++ b/src/bin/typos-cli/args.rs @@ -1,3 +1,4 @@ +use clap::builder::TypedValueParser; use clap::Parser; use typos_cli::config; @@ -129,7 +130,11 @@ pub(crate) struct FileArgs { /// Only allow ASCII characters in identifiers 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::().unwrap()) + )] pub(crate) locale: Option, }