-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Remove duplicate -l option for init command #14460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@ruslanys Please sign the Contributor License Agreement! Click here to manually synchronize the status of this Pull Request. See the FAQ for frequently asked questions. |
@ruslanys Thank you for signing the Contributor License Agreement! |
Fix #13940 |
Very interesting that the duplicate causes it to just disappear. I wonder if we can force the app to fail hard when that happens? |
@philwebb I agree this is strange behavior. Moreover, for options recognizing Spring Boot CLI is using So, one of the ideas is to update the private void checkOptionsUniqueness() {
List<String> keys = parser.recognizedOptions().values().stream()
.distinct()
.flatMap(optionSpec -> optionSpec.options().stream())
.collect(Collectors.toList());
Set<String> hashSet = new HashSet<>();
for (String key : keys) {
if (!hashSet.add(key)) {
throw new IllegalStateException("Option key [" + key + "] is duplicated.");
}
}
} I can provide a separate PR for this. |
Unfortunately, the example above won't fix all problems. |
The second approach is to validate option name and aliases at |
* pr/14460: Polish "Remove duplicate -l option for init command" Remove duplicate -l option for init command
Closed by 6e6c22c |
@ruslanys thank you very much for making your first contribution to Spring Boot. |
--list
option should be displayed by default out-of-the-box. ButInitCommand
had 2 options with-l
key:-l
for--language
and-l
for--list
. In that case, whenOptionHelpFormatter.format(...)
pushing options into TreeSet, the--list
option disappears.