Skip to content

Commit

Permalink
fix(cli): Don't crash on --locale
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 4, 2022
1 parent e87d192 commit f71f83b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bin/typos-cli/args.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use clap::builder::TypedValueParser;
use clap::Parser;

use typos_cli::config;
Expand Down Expand Up @@ -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::<config::Locale>().unwrap())
)]
pub(crate) locale: Option<config::Locale>,
}

Expand Down

0 comments on commit f71f83b

Please sign in to comment.