Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-258

PosixParser.parse continues to parse even after non-option parameter is appeared

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.3
    • None
    • CLI-1.x
    • None

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            yasuko.k Yasuko Komiyama
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: