From d2fba24cab32f5d05a52891fd224d720ad736a86 Mon Sep 17 00:00:00 2001 From: husterxsp Date: Thu, 21 Feb 2019 17:26:46 +0800 Subject: [PATCH] [ISSUE #776] make mqadmin usage information more friendly to user(#796) --- .../tools/command/topic/UpdateTopicSubCommand.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java b/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java index 571f0519..c33ae52d 100644 --- a/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java +++ b/tools/src/main/java/org/apache/rocketmq/tools/command/topic/UpdateTopicSubCommand.java @@ -19,6 +19,7 @@ package org.apache.rocketmq.tools.command.topic; import java.util.Set; import org.apache.commons.cli.CommandLine; import org.apache.commons.cli.Option; +import org.apache.commons.cli.OptionGroup; import org.apache.commons.cli.Options; import org.apache.rocketmq.common.TopicConfig; import org.apache.rocketmq.common.sysflag.TopicSysFlag; @@ -43,13 +44,16 @@ public class UpdateTopicSubCommand implements SubCommand { @Override public Options buildCommandlineOptions(Options options) { + OptionGroup optionGroup = new OptionGroup(); + Option opt = new Option("b", "brokerAddr", true, "create topic to which broker"); - opt.setRequired(false); - options.addOption(opt); + optionGroup.addOption(opt); opt = new Option("c", "clusterName", true, "create topic to which cluster"); - opt.setRequired(false); - options.addOption(opt); + optionGroup.addOption(opt); + + optionGroup.setRequired(true); + options.addOptionGroup(optionGroup); opt = new Option("t", "topic", true, "topic name"); opt.setRequired(true); -- GitLab