diff --git a/src/cli.rs b/src/cli.rs index 514684d63..6849d1ed0 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -158,13 +158,7 @@ impl Cli { Arg::new("output") .long("output") .short('o') - .value_parser(|x: &str| { - if Format::all().contains(&x) { - Ok(x.to_string()) - } else { - Err(format!("Invalid output format: {x:?}")) - } - }) + .value_parser(Format::from_str) .help( "Outputs Tokei in a specific format. Compile with additional features for \ more format support.",