From 8a8437b90216fdefe7a8268088314414d3b34c6a Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Mon, 25 Dec 2017 13:51:37 +0200 Subject: [PATCH] Tell if parameter is mandatory when showing help. --- .../commons/commandline/parameterparser/Parameter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parameter.java b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parameter.java index 32e9594..95df0c0 100755 --- a/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parameter.java +++ b/src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parameter.java @@ -116,7 +116,11 @@ public abstract class Parameter { // first line buffer.append(getAliases()); if (!argumentCount.equals(ArgumentCount.NONE)) { - buffer.append(" (" + describeFormat() + ")"); + buffer + .append(" (") + .append(isMandatory() ? "mandatory, " : "") + .append(describeFormat()) + .append(")"); if (argumentCount.equals(ArgumentCount.MULTI)) buffer.append("..."); -- 2.20.1