Tell if parameter is mandatory when showing help.
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 25 Dec 2017 11:51:37 +0000 (13:51 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Mon, 25 Dec 2017 11:51:37 +0000 (13:51 +0200)
src/main/java/eu/svjatoslav/commons/commandline/parameterparser/Parameter.java

index 32e9594..95df0c0 100755 (executable)
@@ -116,7 +116,11 @@ public abstract class Parameter<T, I extends 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("...");