11/**
2- * Copyright 2003-2004 The Apache Software Foundation
2+ * Copyright 2003-2005 The Apache Software Foundation
33 *
44 * Licensed under the Apache License, Version 2.0 (the "License");
55 * you may not use this file except in compliance with the License.
@@ -113,7 +113,7 @@ public GroupImpl(
113113 this .prefixes = Collections .unmodifiableSet (newPrefixes );
114114 }
115115
116- public boolean canProcess (String arg ) {
116+ public boolean canProcess (final WriteableCommandLine commandLine , String arg ) {
117117 if (arg == null ) {
118118 return false ;
119119 }
@@ -131,11 +131,15 @@ public boolean canProcess(String arg) {
131131 iter .hasNext ();) {
132132
133133 final Option option = (Option ) iter .next ();
134- if (option .canProcess (arg )) {
134+ if (option .canProcess (commandLine , arg )) {
135135 return true ;
136136 }
137137 }
138138
139+ if (commandLine .looksLikeOption (arg )) {
140+ return false ;
141+ }
142+
139143 // anonymous argument(s) means we can process it
140144 if (anonymous .size () > 0 ) {
141145 return true ;
@@ -182,7 +186,7 @@ public void process(
182186 for (Iterator i = values .iterator (); i .hasNext () && !foundMemberOption ;) {
183187 final Option option = (Option ) i .next ();
184188
185- if (option .canProcess (arg )) {
189+ if (option .canProcess (commandLine , arg )) {
186190 foundMemberOption = true ;
187191 arguments .previous ();
188192 option .process (commandLine , arguments );
@@ -210,7 +214,7 @@ public void process(
210214 // canProcess will always return true?
211215 for (final Iterator i = anonymous .iterator (); i .hasNext ();) {
212216 final Argument argument = (Argument )i .next ();
213- if (argument .canProcess (arguments )) {
217+ if (argument .canProcess (commandLine , arguments )) {
214218 argument .process (commandLine , arguments );
215219 }
216220 }
0 commit comments