Claude Warren created CLI-336:
---------------------------------

             Summary: Deprecation use not always reported.
                 Key: CLI-336
                 URL: https://issues.apache.org/jira/browse/CLI-336
             Project: Commons CLI
          Issue Type: Improvement
          Components: CLI-1.x
    Affects Versions: 1.8.0
            Reporter: Claude Warren



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:

# Document the issue in the javadoc for OptionGroup.getSelected() and 
OptionGroup.isSelected() methods.
# 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.




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to