From: Svjatoslav Agejenko Date: Mon, 25 Dec 2017 11:51:37 +0000 (+0200) Subject: Tell if parameter is mandatory when showing help. X-Git-Tag: svjatoslavcommons-1.8~39 X-Git-Url: http://www2.svjatoslav.eu/gitweb/?a=commitdiff_plain;h=8a8437b90216fdefe7a8268088314414d3b34c6a;p=svjatoslav_commons.git Tell if parameter is mandatory when showing help. --- 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("...");