Yasuko Komiyama created CLI-258:
-----------------------------------

             Summary: PosixParser.parse continues to parse even after 
non-option parameter is appeared
                 Key: CLI-258
                 URL: https://issues.apache.org/jira/browse/CLI-258
             Project: Commons CLI
          Issue Type: Bug
          Components: CLI-1.x
    Affects Versions: 1.3
            Reporter: Yasuko Komiyama


If PosixParser.parse(Options options, String[] arguments, Properties 
properties, boolean stopAtNonOption) is called with stopAtNonOption = TRUE, 
once parse() finds any non-option parameter, it is supposed to stop parsing and 
treat all the rest of the parameters 'as is'.  But when one or more than one 
options are appeared before the non-option parameter, the parser continues to 
parse the parameters even after the non-option parameter.  
  If the non-option parameter is appeared before any options, the parser stops 
parsing (as expected).  

For example, when the option -x and -y are configured, the 
PosixParser.parse(options, "nonOption -xvalue1 -yvalue2", properties, TRUE) 
parses the arguments as 'nonOption, -xvalue1, -yvalue2".  But if it is called 
with "-xvalue1 nonOption -yvalue2", then it parses as '-x, value1, nonOption, 
-y, value2".  For the latter case the 3rd parameter "-yvalue2" should not be 
parsed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to