You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "ASF GitHub Bot (JIRA)" <ji...@apache.org> on 2018/11/26 17:11:00 UTC

[jira] [Commented] (KAFKA-6971) Passing in help flag to kafka-console-producer should print arg options

    [ https://issues.apache.org/jira/browse/KAFKA-6971?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16699309#comment-16699309 ] 

ASF GitHub Bot commented on KAFKA-6971:
---------------------------------------

omkreddy closed pull request #5175: KAFKA-6971: Passing in help flag to kafka-console-producer should priā€¦
URL: https://github.com/apache/kafka/pull/5175
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
index b3103ebfa88..8dd6d06eb8f 100755
--- a/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
+++ b/core/src/main/scala/kafka/tools/ConsoleConsumer.scala
@@ -351,7 +351,7 @@ object ConsoleConsumer extends Logging {
       .describedAs("consumer group id")
       .ofType(classOf[String])
 
-    if (args.length == 0)
+    if (args.length == 0 || args(0).equals("--help"))
       CommandLineUtils.printUsageAndDie(parser, "The console consumer is a tool that reads data from Kafka and outputs it to standard output.")
 
     var groupIdPassed = true
diff --git a/core/src/main/scala/kafka/tools/ConsoleProducer.scala b/core/src/main/scala/kafka/tools/ConsoleProducer.scala
index e5b72a3fa19..be34d8d6b89 100644
--- a/core/src/main/scala/kafka/tools/ConsoleProducer.scala
+++ b/core/src/main/scala/kafka/tools/ConsoleProducer.scala
@@ -204,7 +204,7 @@ object ConsoleProducer {
       .ofType(classOf[String])
 
     val options = parser.parse(args : _*)
-    if (args.length == 0)
+    if (args.length == 0 || args(0).equals("--help"))
       CommandLineUtils.printUsageAndDie(parser, "Read data from standard input and publish it to Kafka.")
     CommandLineUtils.checkRequiredArgs(parser, options, topicOpt, brokerListOpt)
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Passing in help flag to kafka-console-producer should print arg options
> -----------------------------------------------------------------------
>
>                 Key: KAFKA-6971
>                 URL: https://issues.apache.org/jira/browse/KAFKA-6971
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core, producer 
>    Affects Versions: 1.1.0
>            Reporter: Yeva Byzek
>            Priority: Minor
>              Labels: newbie
>
> {{kafka-console-consumer --help}} prints "help is not a recognized option" as well as output of options
> {{kafka-console-producer --help}} prints "help is not a recognized option" but no output of options
> Possible solutions:
> (a) Enhance {{kafka-console-producer}} to also print out all options when a user passes in an unrecognized option
> (b) Enhance both {{kafka-console-producer}} and {{kafka-console-consumer}} to legitimately accept the {{--help}} flag



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)