Commons CLI
  1. Commons CLI
  2. CLI-26

[cli] Only long options without short option seems to be noticed

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.0
    • Fix Version/s: 1.1
    • Component/s: CLI-1.x
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Macintosh

      Description

      I've got the following code. The only long option that seems to be noticed after parsing (PosixParser) is
      the one (kOptionConfigFile) that does not have a short option. However, long options without short
      options are ignored by help (except the last one. See COM-690).

      Option help = new Option("h", kOptionHelp, false, "print this message");
      Option version = new Option("v", kOptionVersion, false, "print version information");
      Option newRun = new Option("n", kOptionNew, false, "Create NLT cache entries only for new
      items");
      Option trackerRun = new Option("t", kOptionTracker, false, "Create NLT cache entries only
      for tracker items");

      Option timeLimit = OptionBuilder.withLongOpt(kOptionTimeLimit)
      .hasArg()
      .withValueSeparator()
      .withDescription("Set time limit for execution, in
      mintues")
      .create("l");

      Option age = OptionBuilder.withLongOpt(kOptionAge)
      .hasArg()
      .withValueSeparator()
      .withDescription("Age (in days) of cache item
      before being recomputed")
      .create("a");

      Option server = OptionBuilder.withLongOpt(kOptionNLTServer)
      .hasArg()
      .withValueSeparator()
      .withDescription("The NLT server address")
      .create("s");

      Option numResults = OptionBuilder.withLongOpt(kOptionNumResults)
      .hasArg()
      .withValueSeparator()
      .withDescription("Number of results per item")
      .create("r");

      Option configFile = OptionBuilder.withLongOpt(kOptionConfigFile)
      .hasArg()
      .withValueSeparator()
      .withDescription("Use the specified configuration
      file")
      .create();

      mOptions = new Options();
      mOptions.addOption(help);
      mOptions.addOption(version);
      mOptions.addOption(newRun);
      mOptions.addOption(trackerRun);
      mOptions.addOption(timeLimit);
      mOptions.addOption(age);
      mOptions.addOption(server);
      mOptions.addOption(numResults);
      mOptions.addOption(configFile);

        Activity

        Rick Mann created issue -
        Hide
        Rob Oxspring added a comment -

        This appears to have been fixed, added a test to BugsTest to demonstrate.

        Thanks,

        Rob

        Show
        Rob Oxspring added a comment - This appears to have been fixed, added a test to BugsTest to demonstrate. Thanks, Rob
        Henri Yandell made changes -
        Field Original Value New Value
        issue.field.bugzillaimportkey 27635 12341328
        Henri Yandell made changes -
        Key COM-1176 CLI-26
        Component/s CLI [ 12311104 ]
        Project Commons [ 12310458 ] Commons CLI [ 12310463 ]
        Affects Version/s 1.0 Final [ 12311651 ]
        Assignee Jakarta Commons Developers Mailing List [ commons-dev@jakarta.apache.org ]
        Henri Yandell made changes -
        Affects Version/s 1.0 Final [ 12311698 ]
        Hide
        Henri Yandell added a comment -

        Guessing as to fix version.

        Show
        Henri Yandell added a comment - Guessing as to fix version.
        Henri Yandell made changes -
        Fix Version/s 1.1 [ 12311979 ]
        Bugzilla Id 27635
        Henri Yandell made changes -
        Component/s CLI-1.x [ 12311672 ]
        Henri Yandell made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12370233 ] Default workflow, editable Closed status [ 12601409 ]

        Error rendering 'com.atlassian.jirafisheyeplugin:fisheye-issuepanel'. Please contact your JIRA administrators.

          People

          • Assignee:
            Unassigned
            Reporter:
            Rick Mann
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development