Skip to content

Commit f72129b

Browse files
author
Robert James Oxspring
committed
PatternOptionBuilder now supports required options
PR:10890 Submitted by: Torsten Curdt Reviewed by: Rob Oxspring git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@130025 13f79535-47bb-0310-9956-ffa450edef68
1 parent aa8e3bf commit f72129b

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

project.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979
<dependency>
8080
<id>junit</id>
81-
<version>3.7</version>
81+
<version>3.8.1</version>
8282
</dependency>
8383

8484
</dependencies>

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static boolean isValueCode(char ch)
117117
{
118118
if ((ch != '@') && (ch != ':') && (ch != '%') && (ch != '+')
119119
&& (ch != '#') && (ch != '<') && (ch != '>') && (ch != '*')
120-
&& (ch != '/'))
120+
&& (ch != '/') && (ch != '!'))
121121
{
122122
return false;
123123
}

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

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* version 1.1, a copy of which has been included with this distribution in
66
* the LICENSE file.
77
*
8-
* $Id: BugsTest.java,v 1.16 2003/01/17 20:00:14 jkeyes Exp $
8+
* $Id: BugsTest.java,v 1.17 2004/03/26 19:35:01 roxspring Exp $
99
*/
1010

1111
package org.apache.commons.cli;
@@ -383,5 +383,16 @@ public void test15648() throws Exception {
383383
CommandLine line = parser.parse( options, args );
384384
assertEquals( "Two Words", line.getOptionValue( "m" ) );
385385
}
386+
387+
public void test27575() {
388+
Options options = PatternOptionBuilder.parsePattern("hc!<");
389+
assertNotNull(options);
390+
Option h = options.getOption("-h");
391+
assertNotNull(h);
392+
assertFalse(h.isRequired());
393+
Option c = options.getOption("-c");
394+
assertNotNull(c);
395+
assertTrue(c.isRequired());
396+
}
386397

387398
}

0 commit comments

Comments
 (0)