-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathcommons-cli.diff
24 lines (22 loc) · 986 Bytes
/
commons-cli.diff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Index: src/main/java/org/apache/commons/cli/DefaultParser.java
===================================================================
--- src/main/java/org/apache/commons/cli/DefaultParser.java (revision 1728877)
+++ src/main/java/org/apache/commons/cli/DefaultParser.java (working copy)
@@ -43,6 +43,10 @@
*/
protected boolean stopAtNonOption;
+ protected boolean ignoreUnknownOptions = false;
+
+ public void setIgnoreUnknownOptions(boolean flag) { ignoreUnknownOptions = flag; }
+
/** The token currently processed. */
protected String currentToken;
@@ -342,7 +346,7 @@
*/
private void handleUnknownToken(String token) throws ParseException
{
- if (token.startsWith("-") && token.length() > 1 && !stopAtNonOption)
+ if (token.startsWith("-") && token.length() > 1 && !stopAtNonOption && !ignoreUnknownOptions)
{
throw new UnrecognizedOptionException("Unrecognized option: " + token, token);
}