Skip to content

Commit

Permalink
Merge pull request #609 from epage/locale
Browse files Browse the repository at this point in the history
fix(cli): Don't crash on --locale
  • Loading branch information
epage committed Nov 4, 2022
2 parents e87d192 + f71f83b commit 6c856a0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/bin/typos-cli/args.rs
@@ -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 6c856a0

Please sign in to comment.