You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/07/12 20:02:20 UTC

[GitHub] [kafka] xvrl commented on a change in pull request #11008: KAFKA-10588 Rename kafka-console-consumer CLI command line arguments for KIP-629

xvrl commented on a change in pull request #11008:
URL: https://github.com/apache/kafka/pull/11008#discussion_r668178829



##########
File path: core/src/main/scala/kafka/tools/ConsoleConsumer.scala
##########
@@ -315,11 +321,21 @@ object ConsoleConsumer extends Logging {
 
     formatter.configure(formatterArgs.asScala.asJava)
 
-    val topicOrFilterOpt = List(topicOpt, whitelistOpt).filter(options.has)
-    if (topicOrFilterOpt.size != 1)
-      CommandLineUtils.printUsageAndDie(parser, "Exactly one of whitelist/topic is required.")
+    val filterOpts = List(includeOpt, whitelistOpt).filter(options.has)
+    if (filterOpts.size == 2) {
+      CommandLineUtils.warn("--whitelist is DEPRECATED and ignored if --include specified.")
+    }
+
     topicArg = options.valueOf(topicOpt)
-    whitelistArg = options.valueOf(whitelistOpt)
+    includedTopicsArg = if (options.has(includeOpt))
+      options.valueOf(includeOpt)
+    else
+      options.valueOf(whitelistOpt)
+
+    val topicOrFilterOptArgs = Seq(topicArg, includedTopicsArg).filterNot(value => value == null)
+
+    if (topicOrFilterOptArgs.size != 1)
+      CommandLineUtils.printUsageAndDie(parser, "Exactly one of include/topic is required. whitelist is DEPRECATED use --include instead.")

Review comment:
       maybe we can check `options.has(whitelistOpt)` here and only print the deprecation message if they provide the deprecated argument?




-- 
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-unsubscribe@kafka.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org