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

PosixParser doesn't stop the parsing on "--" tokens following an option with an argument

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.3
    • Component/s: Parser
    • Labels:
      None

      Description

      PosixParser doesn't stop on "--" tokens if the option preceding the token expects an argument. GnuParser is not affected by this issue.

      Test case:

      public void testDoubleHyphenToken() throws Exception
      {
          Options options = new Options();
          options.addOption(OptionBuilder.hasArg().create('n'));
          options.addOption(OptionBuilder.create('m'));
      
          CommandLine cl = parser.parse(options, new String[] { "-n", "--", "-m" });
      
          assertTrue(cl.hasOption("n"));
          assertFalse(cl.hasOption("m"));
      }
      

        Attachments

          Activity

            People

            • Assignee:
              ebourg Emmanuel Bourg
              Reporter:
              ebourg Emmanuel Bourg
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: