From 8b267f4436f1e3b3cf70f30ef4a3fbc86c0fd310 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 26 Jun 2024 20:29:10 -0700 Subject: [PATCH 1/8] Use clap ValueParser for dump format --- src/config.rs | 26 +++++--------------------- src/dump_format.rs | 2 +- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/src/config.rs b/src/config.rs index c32d62b3f0..55bbcf063f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -131,9 +131,7 @@ mod arg { COMMAND_COLOR_YELLOW, ]; - pub(crate) const DUMP_FORMAT_JSON: &str = "json"; pub(crate) const DUMP_FORMAT_JUST: &str = "just"; - pub(crate) const DUMP_FORMAT_VALUES: &[&str] = &[DUMP_FORMAT_JUST, DUMP_FORMAT_JSON]; } impl Config { @@ -225,7 +223,7 @@ impl Config { .long("dump-format") .env("JUST_DUMP_FORMAT") .action(ArgAction::Set) - .value_parser(PossibleValuesParser::new(arg::DUMP_FORMAT_VALUES)) + .value_parser(clap::value_parser!(DumpFormat)) .default_value(arg::DUMP_FORMAT_JUST) .value_name("FORMAT") .help("Dump justfile as "), @@ -567,23 +565,6 @@ impl Config { } } - fn dump_format_from_matches(matches: &ArgMatches) -> ConfigResult { - let value = - matches - .get_one::(arg::DUMP_FORMAT) - .ok_or_else(|| ConfigError::Internal { - message: "`--dump-format` had no value".to_string(), - })?; - - match value.as_str() { - arg::DUMP_FORMAT_JSON => Ok(DumpFormat::Json), - arg::DUMP_FORMAT_JUST => Ok(DumpFormat::Just), - _ => Err(ConfigError::Internal { - message: format!("Invalid argument `{value}` to --dump-format."), - }), - } - } - fn parse_module_path(values: ValuesRef) -> ConfigResult { let path = values.clone().map(|s| (*s).as_str()).collect::>(); @@ -755,7 +736,10 @@ impl Config { .map(Into::into), dotenv_path: matches.get_one::(arg::DOTENV_PATH).map(Into::into), dry_run: matches.get_flag(arg::DRY_RUN), - dump_format: Self::dump_format_from_matches(matches)?, + dump_format: matches + .get_one::(arg::DUMP_FORMAT) + .unwrap() + .clone(), highlight: !matches.get_flag(arg::NO_HIGHLIGHT), invocation_directory: env::current_dir().context(config_error::CurrentDirContext)?, list_heading: matches diff --git a/src/dump_format.rs b/src/dump_format.rs index e560ae0298..0a912decfc 100644 --- a/src/dump_format.rs +++ b/src/dump_format.rs @@ -1,4 +1,4 @@ -#[derive(Debug, PartialEq)] +#[derive(Debug, PartialEq, Clone, clap::ValueEnum)] pub(crate) enum DumpFormat { Json, Just, From 6fe6ce83f3c01cd49267468a6a00b8b199f6028e Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 26 Jun 2024 20:43:40 -0700 Subject: [PATCH 2/8] Same with UseColor --- src/color.rs | 10 ++++++++++ src/config.rs | 24 ++---------------------- src/use_color.rs | 2 +- 3 files changed, 13 insertions(+), 23 deletions(-) diff --git a/src/color.rs b/src/color.rs index f477d4e311..ebd4a04026 100644 --- a/src/color.rs +++ b/src/color.rs @@ -38,6 +38,7 @@ impl Color { } } + #[cfg(test)] pub(crate) fn always() -> Self { Self { use_color: UseColor::Always, @@ -133,6 +134,15 @@ impl Color { } } +impl From for Color { + fn from(value: UseColor) -> Self { + Self { + use_color: value, + ..Default::default() + } + } +} + impl Default for Color { fn default() -> Self { Self { diff --git a/src/config.rs b/src/config.rs index 55bbcf063f..e2183631ce 100644 --- a/src/config.rs +++ b/src/config.rs @@ -109,10 +109,7 @@ mod arg { pub(crate) const WORKING_DIRECTORY: &str = "WORKING-DIRECTORY"; pub(crate) const YES: &str = "YES"; - pub(crate) const COLOR_ALWAYS: &str = "always"; pub(crate) const COLOR_AUTO: &str = "auto"; - pub(crate) const COLOR_NEVER: &str = "never"; - pub(crate) const COLOR_VALUES: &[&str] = &[COLOR_AUTO, COLOR_ALWAYS, COLOR_NEVER]; pub(crate) const COMMAND_COLOR_BLACK: &str = "black"; pub(crate) const COMMAND_COLOR_BLUE: &str = "blue"; @@ -182,7 +179,7 @@ impl Config { .long("color") .env("JUST_COLOR") .action(ArgAction::Set) - .value_parser(PossibleValuesParser::new(arg::COLOR_VALUES)) + .value_parser(clap::value_parser!(UseColor)) .default_value(arg::COLOR_AUTO) .help("Print colorful output"), ) @@ -529,23 +526,6 @@ impl Config { ) } - fn color_from_matches(matches: &ArgMatches) -> ConfigResult { - let value = matches - .get_one::(arg::COLOR) - .ok_or_else(|| ConfigError::Internal { - message: "`--color` had no value".to_string(), - })?; - - match value.as_str() { - arg::COLOR_AUTO => Ok(Color::auto()), - arg::COLOR_ALWAYS => Ok(Color::always()), - arg::COLOR_NEVER => Ok(Color::never()), - _ => Err(ConfigError::Internal { - message: format!("Invalid argument `{value}` to --color."), - }), - } - } - fn command_color_from_matches(matches: &ArgMatches) -> ConfigResult> { if let Some(value) = matches.get_one::(arg::COMMAND_COLOR) { match value.as_str() { @@ -729,7 +709,7 @@ impl Config { Ok(Self { check: matches.get_flag(arg::CHECK), - color: Self::color_from_matches(matches)?, + color: (*matches.get_one::(arg::COLOR).unwrap()).into(), command_color: Self::command_color_from_matches(matches)?, dotenv_filename: matches .get_one::(arg::DOTENV_FILENAME) diff --git a/src/use_color.rs b/src/use_color.rs index 131ec6d588..6c8d93da78 100644 --- a/src/use_color.rs +++ b/src/use_color.rs @@ -1,4 +1,4 @@ -#[derive(Copy, Clone, Debug, PartialEq)] +#[derive(Copy, Clone, Debug, PartialEq, clap::ValueEnum)] pub(crate) enum UseColor { Auto, Always, From dbc10cb6a58fd9b060c74815cb6d0a7ac95a50bd Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Sun, 30 Jun 2024 02:13:54 -0700 Subject: [PATCH 3/8] command color value --- src/config.rs | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/config.rs b/src/config.rs index e2183631ce..d81aa8e298 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,7 +1,9 @@ use { super::*, clap::{ - builder::{styling::AnsiColor, FalseyValueParser, PossibleValuesParser, Styles}, + builder::{ + styling::AnsiColor, FalseyValueParser, PossibleValuesParser, Styles, TypedValueParser, + }, parser::ValuesRef, value_parser, Arg, ArgAction, ArgGroup, ArgMatches, Command, }, @@ -188,7 +190,22 @@ impl Config { .long("command-color") .env("JUST_COMMAND_COLOR") .action(ArgAction::Set) - .value_parser(PossibleValuesParser::new(arg::COMMAND_COLOR_VALUES)) + .value_parser( + PossibleValuesParser::new(arg::COMMAND_COLOR_VALUES).try_map(|value| { + match value.as_str() { + arg::COMMAND_COLOR_BLACK => Ok(ansi_term::Color::Black), + arg::COMMAND_COLOR_BLUE => Ok(ansi_term::Color::Blue), + arg::COMMAND_COLOR_CYAN => Ok(ansi_term::Color::Cyan), + arg::COMMAND_COLOR_GREEN => Ok(ansi_term::Color::Green), + arg::COMMAND_COLOR_PURPLE => Ok(ansi_term::Color::Purple), + arg::COMMAND_COLOR_RED => Ok(ansi_term::Color::Red), + arg::COMMAND_COLOR_YELLOW => Ok(ansi_term::Color::Yellow), + value => Err(ConfigError::Internal { + message: format!("Invalid argument `{value}` to --command-color."), + }), + } + }), + ) .help("Echo recipe lines in "), ) .arg( @@ -526,25 +543,6 @@ impl Config { ) } - fn command_color_from_matches(matches: &ArgMatches) -> ConfigResult> { - if let Some(value) = matches.get_one::(arg::COMMAND_COLOR) { - match value.as_str() { - arg::COMMAND_COLOR_BLACK => Ok(Some(ansi_term::Color::Black)), - arg::COMMAND_COLOR_BLUE => Ok(Some(ansi_term::Color::Blue)), - arg::COMMAND_COLOR_CYAN => Ok(Some(ansi_term::Color::Cyan)), - arg::COMMAND_COLOR_GREEN => Ok(Some(ansi_term::Color::Green)), - arg::COMMAND_COLOR_PURPLE => Ok(Some(ansi_term::Color::Purple)), - arg::COMMAND_COLOR_RED => Ok(Some(ansi_term::Color::Red)), - arg::COMMAND_COLOR_YELLOW => Ok(Some(ansi_term::Color::Yellow)), - value => Err(ConfigError::Internal { - message: format!("Invalid argument `{value}` to --command-color."), - }), - } - } else { - Ok(None) - } - } - fn parse_module_path(values: ValuesRef) -> ConfigResult { let path = values.clone().map(|s| (*s).as_str()).collect::>(); @@ -710,7 +708,9 @@ impl Config { Ok(Self { check: matches.get_flag(arg::CHECK), color: (*matches.get_one::(arg::COLOR).unwrap()).into(), - command_color: Self::command_color_from_matches(matches)?, + command_color: matches + .get_one::(arg::COMMAND_COLOR) + .copied(), dotenv_filename: matches .get_one::(arg::DOTENV_FILENAME) .map(Into::into), From 626b8cce89de3e68550a07a81ca9813a84d55071 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 30 Jun 2024 11:59:07 -0700 Subject: [PATCH 4/8] Enhance --- src/color.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/color.rs b/src/color.rs index ebd4a04026..f14a66207c 100644 --- a/src/color.rs +++ b/src/color.rs @@ -135,9 +135,9 @@ impl Color { } impl From for Color { - fn from(value: UseColor) -> Self { + fn from(use_color: UseColor) -> Self { Self { - use_color: value, + use_color, ..Default::default() } } From 8856c8604db198564dad50df77fe5903adf099e6 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 30 Jun 2024 12:02:59 -0700 Subject: [PATCH 5/8] Amend --- src/completions.rs | 2 +- src/dump_format.rs | 4 +++- src/lib.rs | 1 + src/use_color.rs | 4 +++- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/completions.rs b/src/completions.rs index 0beb4d1f3f..cb567b3b74 100644 --- a/src/completions.rs +++ b/src/completions.rs @@ -1,4 +1,4 @@ -use {super::*, clap::ValueEnum}; +use super::*; #[derive(ValueEnum, Debug, Clone, Copy, PartialEq)] pub(crate) enum Shell { diff --git a/src/dump_format.rs b/src/dump_format.rs index 0a912decfc..b4bd3ccb8f 100644 --- a/src/dump_format.rs +++ b/src/dump_format.rs @@ -1,4 +1,6 @@ -#[derive(Debug, PartialEq, Clone, clap::ValueEnum)] +use super::*; + +#[derive(Debug, PartialEq, Clone, ValueEnum)] pub(crate) enum DumpFormat { Json, Just, diff --git a/src/lib.rs b/src/lib.rs index d787ab1c2c..809af9ded0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,6 +46,7 @@ pub(crate) use { verbosity::Verbosity, warning::Warning, }, camino::Utf8Path, + clap::ValueEnum, derivative::Derivative, edit_distance::edit_distance, lexiclean::Lexiclean, diff --git a/src/use_color.rs b/src/use_color.rs index 6c8d93da78..8086989aa9 100644 --- a/src/use_color.rs +++ b/src/use_color.rs @@ -1,4 +1,6 @@ -#[derive(Copy, Clone, Debug, PartialEq, clap::ValueEnum)] +use super::*; + +#[derive(Copy, Clone, Debug, PartialEq, ValueEnum)] pub(crate) enum UseColor { Auto, Always, From 8c49a3faed36afb3b907f3ccd2599e4176c78150 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 30 Jun 2024 12:04:22 -0700 Subject: [PATCH 6/8] Revise --- src/config.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/config.rs b/src/config.rs index d81aa8e298..f8e021626f 100644 --- a/src/config.rs +++ b/src/config.rs @@ -111,8 +111,6 @@ mod arg { pub(crate) const WORKING_DIRECTORY: &str = "WORKING-DIRECTORY"; pub(crate) const YES: &str = "YES"; - pub(crate) const COLOR_AUTO: &str = "auto"; - pub(crate) const COMMAND_COLOR_BLACK: &str = "black"; pub(crate) const COMMAND_COLOR_BLUE: &str = "blue"; pub(crate) const COMMAND_COLOR_CYAN: &str = "cyan"; @@ -129,8 +127,6 @@ mod arg { COMMAND_COLOR_RED, COMMAND_COLOR_YELLOW, ]; - - pub(crate) const DUMP_FORMAT_JUST: &str = "just"; } impl Config { @@ -182,7 +178,7 @@ impl Config { .env("JUST_COLOR") .action(ArgAction::Set) .value_parser(clap::value_parser!(UseColor)) - .default_value(arg::COLOR_AUTO) + .default_value("auto") .help("Print colorful output"), ) .arg( @@ -238,7 +234,7 @@ impl Config { .env("JUST_DUMP_FORMAT") .action(ArgAction::Set) .value_parser(clap::value_parser!(DumpFormat)) - .default_value(arg::DUMP_FORMAT_JUST) + .default_value("just") .value_name("FORMAT") .help("Dump justfile as "), ) From d5d63c935d100ff605287b2cd24b506d2ddfef95 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 30 Jun 2024 12:10:10 -0700 Subject: [PATCH 7/8] Revise --- src/command_color.rs | 26 ++++++++++++++++++++++++++ src/config.rs | 43 +++++-------------------------------------- src/lib.rs | 35 ++++++++++++++++++----------------- 3 files changed, 49 insertions(+), 55 deletions(-) create mode 100644 src/command_color.rs diff --git a/src/command_color.rs b/src/command_color.rs new file mode 100644 index 0000000000..4e798be0de --- /dev/null +++ b/src/command_color.rs @@ -0,0 +1,26 @@ +use super::*; + +#[derive(Copy, Clone, ValueEnum)] +pub(crate) enum CommandColor { + Black, + Blue, + Cyan, + Green, + Purple, + Red, + Yellow, +} + +impl Into for CommandColor { + fn into(self) -> ansi_term::Color { + match self { + Self::Black => ansi_term::Color::Black, + Self::Blue => ansi_term::Color::Blue, + Self::Cyan => ansi_term::Color::Cyan, + Self::Green => ansi_term::Color::Green, + Self::Purple => ansi_term::Color::Purple, + Self::Red => ansi_term::Color::Red, + Self::Yellow => ansi_term::Color::Yellow, + } + } +} diff --git a/src/config.rs b/src/config.rs index f8e021626f..1ba1e2b1a0 100644 --- a/src/config.rs +++ b/src/config.rs @@ -1,9 +1,7 @@ use { super::*, clap::{ - builder::{ - styling::AnsiColor, FalseyValueParser, PossibleValuesParser, Styles, TypedValueParser, - }, + builder::{styling::AnsiColor, FalseyValueParser, Styles}, parser::ValuesRef, value_parser, Arg, ArgAction, ArgGroup, ArgMatches, Command, }, @@ -110,23 +108,6 @@ mod arg { pub(crate) const VERBOSE: &str = "VERBOSE"; pub(crate) const WORKING_DIRECTORY: &str = "WORKING-DIRECTORY"; pub(crate) const YES: &str = "YES"; - - pub(crate) const COMMAND_COLOR_BLACK: &str = "black"; - pub(crate) const COMMAND_COLOR_BLUE: &str = "blue"; - pub(crate) const COMMAND_COLOR_CYAN: &str = "cyan"; - pub(crate) const COMMAND_COLOR_GREEN: &str = "green"; - pub(crate) const COMMAND_COLOR_PURPLE: &str = "purple"; - pub(crate) const COMMAND_COLOR_RED: &str = "red"; - pub(crate) const COMMAND_COLOR_YELLOW: &str = "yellow"; - pub(crate) const COMMAND_COLOR_VALUES: &[&str] = &[ - COMMAND_COLOR_BLACK, - COMMAND_COLOR_BLUE, - COMMAND_COLOR_CYAN, - COMMAND_COLOR_GREEN, - COMMAND_COLOR_PURPLE, - COMMAND_COLOR_RED, - COMMAND_COLOR_YELLOW, - ]; } impl Config { @@ -186,22 +167,7 @@ impl Config { .long("command-color") .env("JUST_COMMAND_COLOR") .action(ArgAction::Set) - .value_parser( - PossibleValuesParser::new(arg::COMMAND_COLOR_VALUES).try_map(|value| { - match value.as_str() { - arg::COMMAND_COLOR_BLACK => Ok(ansi_term::Color::Black), - arg::COMMAND_COLOR_BLUE => Ok(ansi_term::Color::Blue), - arg::COMMAND_COLOR_CYAN => Ok(ansi_term::Color::Cyan), - arg::COMMAND_COLOR_GREEN => Ok(ansi_term::Color::Green), - arg::COMMAND_COLOR_PURPLE => Ok(ansi_term::Color::Purple), - arg::COMMAND_COLOR_RED => Ok(ansi_term::Color::Red), - arg::COMMAND_COLOR_YELLOW => Ok(ansi_term::Color::Yellow), - value => Err(ConfigError::Internal { - message: format!("Invalid argument `{value}` to --command-color."), - }), - } - }), - ) + .value_parser(clap::value_parser!(CommandColor)) .help("Echo recipe lines in "), ) .arg( @@ -705,8 +671,9 @@ impl Config { check: matches.get_flag(arg::CHECK), color: (*matches.get_one::(arg::COLOR).unwrap()).into(), command_color: matches - .get_one::(arg::COMMAND_COLOR) - .copied(), + .get_one::(arg::COMMAND_COLOR) + .copied() + .map(|command_color| command_color.into()), dotenv_filename: matches .get_one::(arg::DOTENV_FILENAME) .map(Into::into), diff --git a/src/lib.rs b/src/lib.rs index 809af9ded0..50e54e90bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -23,23 +23,23 @@ pub(crate) use { crate::{ alias::Alias, analyzer::Analyzer, argument_parser::ArgumentParser, assignment::Assignment, assignment_resolver::AssignmentResolver, ast::Ast, attribute::Attribute, binding::Binding, - color::Color, color_display::ColorDisplay, command_ext::CommandExt, compilation::Compilation, - compile_error::CompileError, compile_error_kind::CompileErrorKind, compiler::Compiler, - condition::Condition, conditional_operator::ConditionalOperator, config::Config, - config_error::ConfigError, constants::constants, count::Count, delimiter::Delimiter, - dependency::Dependency, dump_format::DumpFormat, enclosure::Enclosure, error::Error, - evaluator::Evaluator, execution_context::ExecutionContext, expression::Expression, - fragment::Fragment, function::Function, interrupt_guard::InterruptGuard, - interrupt_handler::InterruptHandler, item::Item, justfile::Justfile, keyed::Keyed, - keyword::Keyword, lexer::Lexer, line::Line, list::List, load_dotenv::load_dotenv, - loader::Loader, module_path::ModulePath, name::Name, namepath::Namepath, ordinal::Ordinal, - output::output, output_error::OutputError, parameter::Parameter, parameter_kind::ParameterKind, - parser::Parser, platform::Platform, platform_interface::PlatformInterface, position::Position, - positional::Positional, ran::Ran, range_ext::RangeExt, recipe::Recipe, - recipe_resolver::RecipeResolver, recipe_signature::RecipeSignature, scope::Scope, - search::Search, search_config::SearchConfig, search_error::SearchError, set::Set, - setting::Setting, settings::Settings, shebang::Shebang, shell::Shell, - show_whitespace::ShowWhitespace, source::Source, string_kind::StringKind, + color::Color, color_display::ColorDisplay, command_color::CommandColor, + command_ext::CommandExt, compilation::Compilation, compile_error::CompileError, + compile_error_kind::CompileErrorKind, compiler::Compiler, condition::Condition, + conditional_operator::ConditionalOperator, config::Config, config_error::ConfigError, + constants::constants, count::Count, delimiter::Delimiter, dependency::Dependency, + dump_format::DumpFormat, enclosure::Enclosure, error::Error, evaluator::Evaluator, + execution_context::ExecutionContext, expression::Expression, fragment::Fragment, + function::Function, interrupt_guard::InterruptGuard, interrupt_handler::InterruptHandler, + item::Item, justfile::Justfile, keyed::Keyed, keyword::Keyword, lexer::Lexer, line::Line, + list::List, load_dotenv::load_dotenv, loader::Loader, module_path::ModulePath, name::Name, + namepath::Namepath, ordinal::Ordinal, output::output, output_error::OutputError, + parameter::Parameter, parameter_kind::ParameterKind, parser::Parser, platform::Platform, + platform_interface::PlatformInterface, position::Position, positional::Positional, ran::Ran, + range_ext::RangeExt, recipe::Recipe, recipe_resolver::RecipeResolver, + recipe_signature::RecipeSignature, scope::Scope, search::Search, search_config::SearchConfig, + search_error::SearchError, set::Set, setting::Setting, settings::Settings, shebang::Shebang, + shell::Shell, show_whitespace::ShowWhitespace, source::Source, string_kind::StringKind, string_literal::StringLiteral, subcommand::Subcommand, suggestion::Suggestion, table::Table, thunk::Thunk, token::Token, token_kind::TokenKind, unresolved_dependency::UnresolvedDependency, unresolved_recipe::UnresolvedRecipe, use_color::UseColor, variables::Variables, @@ -129,6 +129,7 @@ mod attribute; mod binding; mod color; mod color_display; +mod command_color; mod command_ext; mod compilation; mod compile_error; From 306645f59a557c294e99caf7ecb1417c34c295ab Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Sun, 30 Jun 2024 12:13:41 -0700 Subject: [PATCH 8/8] Adapt --- src/command_color.rs | 20 ++++++++++---------- src/config.rs | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/command_color.rs b/src/command_color.rs index 4e798be0de..6703b1031c 100644 --- a/src/command_color.rs +++ b/src/command_color.rs @@ -11,16 +11,16 @@ pub(crate) enum CommandColor { Yellow, } -impl Into for CommandColor { - fn into(self) -> ansi_term::Color { - match self { - Self::Black => ansi_term::Color::Black, - Self::Blue => ansi_term::Color::Blue, - Self::Cyan => ansi_term::Color::Cyan, - Self::Green => ansi_term::Color::Green, - Self::Purple => ansi_term::Color::Purple, - Self::Red => ansi_term::Color::Red, - Self::Yellow => ansi_term::Color::Yellow, +impl From for ansi_term::Color { + fn from(command_color: CommandColor) -> Self { + match command_color { + CommandColor::Black => Self::Black, + CommandColor::Blue => Self::Blue, + CommandColor::Cyan => Self::Cyan, + CommandColor::Green => Self::Green, + CommandColor::Purple => Self::Purple, + CommandColor::Red => Self::Red, + CommandColor::Yellow => Self::Yellow, } } } diff --git a/src/config.rs b/src/config.rs index 1ba1e2b1a0..2595c89177 100644 --- a/src/config.rs +++ b/src/config.rs @@ -673,7 +673,7 @@ impl Config { command_color: matches .get_one::(arg::COMMAND_COLOR) .copied() - .map(|command_color| command_color.into()), + .map(CommandColor::into), dotenv_filename: matches .get_one::(arg::DOTENV_FILENAME) .map(Into::into),