garydgregory commented on code in PR #233:
URL: https://github.com/apache/commons-cli/pull/233#discussion_r1491166079


##########
src/main/java/org/apache/commons/cli/DefaultParser.java:
##########
@@ -228,6 +228,9 @@ private DefaultParser(final boolean allowPartialMatching,
      */
     private void checkRequiredArgs() throws ParseException {
         if (currentOption != null && currentOption.requiresArg()) {
+            if (isJavaProperty(currentOption.getKey()) && 
currentOption.numberOfValues() == 1) {

Review Comment:
    Instead of adding a method that's only used once, you can say instead 
`currentOption.getValue() != null` or `currentOption.getValuesList().size() == 
1`



##########
src/main/java/org/apache/commons/cli/Option.java:
##########
@@ -722,6 +722,16 @@ private boolean hasNoValues() {
         return values.isEmpty();
     }
 
+    /**
+     * Returns the number of values this option has.
+     *
+     * @return the number of values this option has.
+     * @since 1.7.0
+     */
+    int numberOfValues() {

Review Comment:
   Unnecessary IMO, especially since it is not public and only used once. See 
above.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@commons.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to