Could not format default value for log formats (#25910)

Closes #25908

Signed-off-by: Martin Bartoš <mabartos@redhat.com>
This commit is contained in:
Martin Bartoš 2024-01-09 12:53:12 +01:00 committed by GitHub
parent 1e29bc99c0
commit 55d0a32b09
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -638,7 +638,10 @@ public final class Picocli {
transformedDesc.append(" Possible values are: " + String.join(", ", mapper.getExpectedValues()) + "."); transformedDesc.append(" Possible values are: " + String.join(", ", mapper.getExpectedValues()) + ".");
} }
mapper.getDefaultValue().map(d -> " Default: " + d + ".").ifPresent(transformedDesc::append); mapper.getDefaultValue()
.map(d -> d.toString().replaceAll("%", "%%")) // escape formats
.map(d -> " Default: " + d + ".")
.ifPresent(transformedDesc::append);
mapper.getDeprecatedMetadata().ifPresent(deprecatedMetadata -> { mapper.getDeprecatedMetadata().ifPresent(deprecatedMetadata -> {
List<String> deprecatedDetails = new ArrayList<>(); List<String> deprecatedDetails = new ArrayList<>();