Skip to content

Commit 02549ab

Browse files
committed
Do not attempt to output default and undocumented at the same time.
1 parent 2b0105b commit 02549ab

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

src/main/java/uk/co/spudsoft/params4j/ConfigurationProperty.java

+9-11
Original file line numberDiff line numberDiff line change
@@ -241,17 +241,16 @@ public void appendUsage(StringBuilder builder, int maxNameLen) {
241241
builder.append(" ")
242242
.append(typeName);
243243

244-
if (defaultValue != null) {
245-
builder.append(" ".repeat(typeName.length() + 10 > maxNameLen ? 1 : maxNameLen - typeName.length() - 3))
246-
.append("default: ")
247-
.append(defaultValue);
248-
}
249244
if (undocumented) {
250245
builder.append(" ".repeat(typeName.length() + 10 > maxNameLen ? 1 : maxNameLen - typeName.length() - 3))
251246
.append("This parameter is undocumented, consult the source for ")
252247
.append(type)
253248
.append(" for details of the values for <***>");
254249

250+
} else if (defaultValue != null) {
251+
builder.append(" ".repeat(typeName.length() + 10 > maxNameLen ? 1 : maxNameLen - typeName.length() - 3))
252+
.append("default: ")
253+
.append(defaultValue);
255254
}
256255
builder.append("\n\n");
257256
}
@@ -304,20 +303,19 @@ public void appendEnv(StringBuilder builder, int maxNameLen, String prefixStrip,
304303
builder.append(" ")
305304
.append(typeName);
306305

307-
if (defaultValue != null) {
308-
builder.append(" ".repeat(typeName.length() + 10 > maxNameLen ? 1 : maxNameLen - typeName.length() - 3))
309-
.append("default: ")
310-
.append(defaultValue);
311-
}
312-
313306
if (undocumented) {
314307
builder.append(" ".repeat(typeName.length() + 10 > maxNameLen ? 1 : maxNameLen - typeName.length() - 3))
315308
.append("This parameter is undocumented, consult the source for ")
316309
.append(type)
317310
.append(" for details of the values for <***>");
318311

312+
} else if (defaultValue != null) {
313+
builder.append(" ".repeat(typeName.length() + 10 > maxNameLen ? 1 : maxNameLen - typeName.length() - 3))
314+
.append("default: ")
315+
.append(defaultValue);
319316
}
320317

318+
321319
builder.append("\n\n");
322320
}
323321
}

0 commit comments

Comments
 (0)