Skip to content

Commit f1a32a5

Browse files
author
John Keyes
committed
added support for special long options like in ls
git-svn-id: https://svn.apache.org/repos/asf/jakarta/commons/proper/cli/trunk@129810 13f79535-47bb-0310-9956-ffa450edef68
1 parent d30f12f commit f1a32a5

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

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

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
2-
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/java/org/apache/commons/cli/PosixParser.java,v 1.9 2002/08/26 20:15:02 jkeyes Exp $
3-
* $Revision: 1.9 $
4-
* $Date: 2002/08/26 20:15:02 $
2+
* $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//cli/src/java/org/apache/commons/cli/PosixParser.java,v 1.10 2002/09/09 19:35:24 jkeyes Exp $
3+
* $Revision: 1.10 $
4+
* $Date: 2002/09/09 19:35:24 $
55
*
66
* ====================================================================
77
*
@@ -72,7 +72,7 @@
7272
*
7373
* @author John Keyes (jbjk at mac.com)
7474
* @see Parser
75-
* @version $Revision: 1.9 $
75+
* @version $Revision: 1.10 $
7676
*/
7777
public class PosixParser extends Parser {
7878

@@ -153,7 +153,14 @@ protected String[] flatten( Options options,
153153

154154
// handle SPECIAL TOKEN
155155
if( token.startsWith( "--" ) ) {
156-
tokens.add( token );
156+
if( token.indexOf( '=' ) != -1 ) {
157+
tokens.add( token.substring( 0, token.indexOf( '=' ) ) );
158+
tokens.add( token.substring( token.indexOf( '=' ) + 1,
159+
token.length() ) );
160+
}
161+
else {
162+
tokens.add( token );
163+
}
157164
}
158165
// single hyphen
159166
else if( "-".equals( token ) ) {

0 commit comments

Comments
 (0)