Skip to content

Commit

Permalink
Fix color option
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Nov 25, 2024
1 parent 8c77069 commit 8adabb1
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion common/src/main/java/org/mvndaemon/mvnd/common/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,18 @@ public enum Color {
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'.");
}
}
}

Expand Down

0 comments on commit 8adabb1

Please sign in to comment.