Skip to content

Commit 3433f46

Browse files
committed
The processing of the default options is no longer stopped by a flag with a false value (CLI-201)
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/cli/trunk@955096 13f79535-47bb-0310-9956-ffa450edef68
1 parent 10b14af commit 3433f46

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

src/java/org/apache/commons/cli/Parser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ else if (!("yes".equalsIgnoreCase(value)
287287
{
288288
// if the value is not yes, true or 1 then don't add the
289289
// option to the CommandLine
290-
break;
290+
continue;
291291
}
292292

293293
cmd.addOption(opt);

src/test/org/apache/commons/cli/ValueTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ public void testPropertyOptionFlags() throws Exception
212212
cmd = parser.parse(opts, null, properties);
213213
assertTrue( !cmd.hasOption("a") );
214214
assertTrue( !cmd.hasOption("c") );
215-
assertTrue( !cmd.hasOption("e") );
215+
assertTrue( cmd.hasOption("e") ); // this option accepts as argument
216216

217217

218218
properties = new Properties();
@@ -233,7 +233,7 @@ public void testPropertyOptionFlags() throws Exception
233233
cmd = parser.parse(opts, null, properties);
234234
assertTrue( !cmd.hasOption("a") );
235235
assertTrue( !cmd.hasOption("c") );
236-
assertTrue( !cmd.hasOption("e") );
236+
assertTrue( cmd.hasOption("e") );
237237
}
238238

239239
public void testPropertyOptionMultipleValues() throws Exception

0 commit comments

Comments
 (0)