Browse Source

Move CLI multiplicity into the enumeration.

Timur Sağlam 4 years ago
parent
commit
887c10f00c

+ 1 - 1
jplag/src/main/java/de/jplag/CommandLineArgument.java

@@ -120,7 +120,7 @@ public enum CommandLineArgument {
             argument.action(storeTrue());
         }
         if (numberOfValues == NumberOfArgumentValues.ONE_OR_MORE_VALUES) {
-            argument.nargs("+");
+            argument.nargs(numberOfValues.toString());
         }
     }
 

+ 16 - 3
jplag/src/main/java/de/jplag/NumberOfArgumentValues.java

@@ -1,7 +1,20 @@
 package de.jplag;
 
-/** Allowed number of values of an argument. */
+/**
+ * Allowed number of values of a command-line argument in the CLI.
+ */
 public enum NumberOfArgumentValues {
-    SINGLE_VALUE,
-    ONE_OR_MORE_VALUES,
+    SINGLE_VALUE(""),
+    ONE_OR_MORE_VALUES("+"),;
+
+    private final String representation;
+
+    private NumberOfArgumentValues(String representation) {
+        this.representation = representation;
+    }
+
+    @Override
+    public String toString() {
+        return representation;
+    }
 }