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.
I also think that there should be some information about this use case. I
think there are 2 solutions:
1. Document the behaviour and the solution to ensure that the result is
logged.
2. add a commandLine.hasOption(OptionGroup) method that basically
performs the equivalent of the OptionGorup equivalent of the
commandLine.hasOption(Option) call.
If we go with option 2 then I think that OptionGorup.getSelected() should
be deprecated and migrated to package private so that users will migrate to
using the commandLine.hasOption(OptionGroup) method. I also think that we
would have to add various commandLine.getValue() methods that take an
OptionGroup as an argument..
Thoughts?
Claude