You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2020/05/24 15:51:58 UTC
[commons-cli] branch master updated: Don't need to nest.
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-cli.git
The following commit(s) were added to refs/heads/master by this push:
new a6f9d7b Don't need to nest.
a6f9d7b is described below
commit a6f9d7bb96045fdb361d12b91095fd55be261080
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Sun May 24 11:51:54 2020 -0400
Don't need to nest.
---
src/main/java/org/apache/commons/cli/DefaultParser.java | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/commons/cli/DefaultParser.java b/src/main/java/org/apache/commons/cli/DefaultParser.java
index d5c3ed7..2dbb106 100644
--- a/src/main/java/org/apache/commons/cli/DefaultParser.java
+++ b/src/main/java/org/apache/commons/cli/DefaultParser.java
@@ -716,17 +716,14 @@ public class DefaultParser implements CommandLineParser
{
return options.getMatchingOptions(token);
}
- else
+ final List<String> matches = new ArrayList<>(1);
+ if (options.hasLongOption(token))
{
- final List<String> matches = new ArrayList<>(1);
- if (options.hasLongOption(token))
- {
- final Option option = options.getOption(token);
- matches.add(option.getLongOpt());
- }
-
- return matches;
+ final Option option = options.getOption(token);
+ matches.add(option.getLongOpt());
}
+
+ return matches;
}
/**