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

Deprecation use not always reported.

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 1.8.0
    • 1.9.0
    • CLI-1.x
    • None

    Description

      I have a case where I have multiple no-argument options in an OptionGroup. The group comprises a deprecated option and a current option. Basically an option rename.

      When I check for the option I simply check if (OptionGroup.getSelected() != null). However if the deprecated value is selected this does not print the log message that says a deprecated value was selected. The only way I could find to do this was to do

      if (OptionGroup.getSelected() != null)

      { commandLine.hasOption(OptionGroup.getSelected()); ... other processing }

      I don't think there is a way to log the issue when the option is selected.

      There are 2 requested changes here:

      1. Document the issue in the javadoc for OptionGroup.getSelected() and OptionGroup.isSelected() methods.
      2. Add a commandLine.hasOption(OptionGroup) method that basically performs the OptionGorup equivalent of the commandLine.hasOption(Option) call as well as the similar getOptionValue(), getOptionValues(), getParsedOption(), and getParsedOptionValues() methods.

      Attachments

        Issue Links

          Activity

            People

              claude Claude Warren
              claude Claude Warren
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: