diff --git a/core/src/main/scala/kafka/admin/TopicCommand.scala b/core/src/main/scala/kafka/admin/TopicCommand.scala index 083fd63..1066f74 100644 --- a/core/src/main/scala/kafka/admin/TopicCommand.scala +++ b/core/src/main/scala/kafka/admin/TopicCommand.scala @@ -42,6 +42,7 @@ object TopicCommand { } CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.zkConnectOpt) + if (!opts.options.has(opts.listOpt)) CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt) val zkClient = new ZkClient(opts.options.valueOf(opts.zkConnectOpt), 30000, 30000, ZKStringSerializer) @@ -71,7 +72,6 @@ object TopicCommand { } def createTopic(zkClient: ZkClient, opts: TopicCommandOptions) { - CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt) val topic = opts.options.valueOf(opts.topicOpt) val configs = parseTopicConfigsToBeAdded(opts) if (opts.options.has(opts.replicaAssignmentOpt)) { @@ -87,7 +87,6 @@ object TopicCommand { } def alterTopic(zkClient: ZkClient, opts: TopicCommandOptions) { - CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt) val topics = getTopics(zkClient, opts) topics.foreach { topic => if(opts.options.has(opts.configOpt) || opts.options.has(opts.deleteConfigOpt)) { @@ -114,7 +113,6 @@ object TopicCommand { } def deleteTopic(zkClient: ZkClient, opts: TopicCommandOptions) { - CommandLineUtils.checkRequiredArgs(opts.parser, opts.options, opts.topicOpt) val topics = getTopics(zkClient, opts) topics.foreach { topic => AdminUtils.deleteTopic(zkClient, topic) @@ -141,7 +139,7 @@ object TopicCommand { } def describeTopic(zkClient: ZkClient, opts: TopicCommandOptions) { - var topics = getTopics(zkClient, opts) + val topics = getTopics(zkClient, opts) val reportUnderReplicatedPartitions = if (opts.options.has(opts.reportUnderReplicatedPartitionsOpt)) true else false val reportUnavailablePartitions = if (opts.options.has(opts.reportUnavailablePartitionsOpt)) true else false val liveBrokers = ZkUtils.getAllBrokersInCluster(zkClient).map(_.id).toSet