chia7712 commented on code in PR #20221: URL: https://github.com/apache/kafka/pull/20221#discussion_r2283352982
########## server-common/src/main/java/org/apache/kafka/server/util/CommandLineUtils.java: ########## @@ -135,6 +138,30 @@ public static void printErrorAndExit(String message) { Exit.exit(1, message); } + /** + * Check that exactly one of a set of mutually exclusive arguments is present. + */ + public static void checkOneOfArgs(OptionParser parser, OptionSet options, OptionSpec<?>... optionSpecs) { + if (optionSpecs == null || optionSpecs.length == 0) { + throw new IllegalArgumentException("At least one option must be provided"); + } + + int presentCount = 0; + for (OptionSpec<?> spec : optionSpecs) { + if (spec != null && options.has(spec)) { Review Comment: Excuse me, is this null check necessary? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: jira-unsubscr...@kafka.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org