This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-mvnd.git

commit a070d0c07d878cf180c9ecd2f87d96c36acff580
Author: Guillaume Nodet <gno...@gmail.com>
AuthorDate: Mon Nov 25 08:40:39 2024 +0100

    Fix color option
---
 .../main/java/org/mvndaemon/mvnd/common/Environment.java  | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java 
b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
index 8378f4d5..55848c53 100644
--- a/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
+++ b/common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
@@ -112,7 +112,7 @@ public enum Environment {
     /** Define */
     MAVEN_DEFINE(null, null, null, OptionType.STRING, Flags.INTERNAL, 
"mvn:-D", "mvn:--define"),
     /** Whether the output should be styled using ANSI color codes; possible 
values: auto, always, never */
-    MAVEN_COLOR("style.color", null, "auto", OptionType.STRING, 
Flags.OPTIONAL, "mvnd:--color"),
+    MAVEN_COLOR("maven.style.color", null, "auto", OptionType.STRING, 
Flags.OPTIONAL, "mvnd:--color"),
 
     //
     // mvnd properties
@@ -584,7 +584,18 @@ public enum Environment {
         auto;
 
         public static Optional<Color> of(String color) {
-            return color == null ? Optional.empty() : 
Optional.of(Color.valueOf(color));
+            if (color == null) {
+                return Optional.empty();
+            } else if ("always".equals(color) || "yes".equals(color) || 
"force".equals(color)) {
+                return Optional.of(Color.always);
+            } else if ("never".equals(color) || "no".equals(color) || 
"none".equals(color)) {
+                return Optional.of(Color.never);
+            } else if ("auto".equals(color) || "tty".equals(color) || 
"if-tty".equals(color)) {
+                return Optional.of(Color.auto);
+            } else {
+                throw new IllegalArgumentException(
+                        "Invalid color configuration value '" + color + "'. 
Supported are 'auto', 'always', 'never'.");
+            }
         }
     }
 

Reply via email to