Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use withRequiredArg while parsing jopt options in all tools; patched …

…by Swapnil Ghike; reviewed by Jun Rao; kafka-786
  • Loading branch information...
commit 2e64c6a5f221c616b2ac222fdadb96618f65e1ec 1 parent a971a27
Swapnil Ghike authored junrao committed
View
10 core/src/main/scala/kafka/tools/DumpLogSegments.scala
@@ -30,17 +30,7 @@ object DumpLogSegments {
def main(args: Array[String]) {
val parser = new OptionParser
val printOpt = parser.accepts("print-data-log", "if set, printing the messages content when dumping data logs")
- .withOptionalArg
- .describedAs("print data log content")
- .ofType(classOf[java.lang.Boolean])
- .defaultsTo(false)
-
val verifyOpt = parser.accepts("verify-index-only", "if set, just verify the index log without printing its content")
- .withOptionalArg
- .describedAs("just verify the index log")
- .ofType(classOf[java.lang.Boolean])
- .defaultsTo(false)
-
val filesOpt = parser.accepts("files", "REQUIRED: The comma separated list of data and index log files to be dumped")
.withRequiredArg
.describedAs("file1, file2, ...")
View
4 core/src/main/scala/kafka/tools/JmxTool.scala
@@ -43,7 +43,7 @@ object JmxTool extends Logging {
val attributesOpt =
parser.accepts("attributes", "The whitelist of attributes to query. This is a comma-separated list. If no " +
"attributes are specified all objects will be queried.")
- .withOptionalArg()
+ .withRequiredArg
.describedAs("name")
.ofType(classOf[String])
val reportingIntervalOpt = parser.accepts("reporting-interval", "Interval in MS with which to poll jmx stats.")
@@ -54,7 +54,7 @@ object JmxTool extends Logging {
val helpOpt = parser.accepts("help", "Print usage information.")
val dateFormatOpt = parser.accepts("date-format", "The date format to use for formatting the time field. " +
"See java.text.SimpleDateFormat for options.")
- .withOptionalArg()
+ .withRequiredArg
.describedAs("format")
.ofType(classOf[String])
val jmxServiceUrlOpt =
View
8 core/src/main/scala/kafka/tools/SimpleConsumerShell.scala
@@ -54,12 +54,12 @@ object SimpleConsumerShell extends Logging {
.ofType(classOf[java.lang.Integer])
.defaultsTo(UseLeaderReplica)
val offsetOpt = parser.accepts("offset", "The offset id to consume from, default to -2 which means from beginning; while value -1 means from end")
- .withOptionalArg()
+ .withRequiredArg
.describedAs("consume offset")
.ofType(classOf[java.lang.Long])
.defaultsTo(OffsetRequest.EarliestTime)
val clientIdOpt = parser.accepts("clientId", "The ID of this client.")
- .withOptionalArg
+ .withRequiredArg
.describedAs("clientId")
.ofType(classOf[String])
.defaultsTo("SimpleConsumerShell")
@@ -78,10 +78,6 @@ object SimpleConsumerShell extends Logging {
.describedAs("prop")
.ofType(classOf[String])
val printOffsetOpt = parser.accepts("print-offsets", "Print the offsets returned by the iterator")
- .withOptionalArg
- .describedAs("print offsets")
- .ofType(classOf[java.lang.Boolean])
- .defaultsTo(false)
val maxWaitMsOpt = parser.accepts("max-wait-ms", "The max amount of time each fetch request waits.")
.withRequiredArg
.describedAs("ms")
View
2  perf/src/main/scala/kafka/perf/SimpleConsumerPerformance.scala
@@ -134,7 +134,7 @@ object SimpleConsumerPerformance {
.ofType(classOf[java.lang.Integer])
.defaultsTo(1024*1024)
val clientIdOpt = parser.accepts("clientId", "The ID of this client.")
- .withOptionalArg
+ .withRequiredArg
.describedAs("clientId")
.ofType(classOf[String])
.defaultsTo("SimpleConsumerPerformanceClient")
Please sign in to comment.
Something went wrong with that request. Please try again.