mirror of https://github.com/apache/kafka.git
Use withRequiredArg while parsing jopt options in all tools; patched by Swapnil Ghike; reviewed by Jun Rao; kafka-786
This commit is contained in:
parent
a971a27b59
commit
2e64c6a5f2
|
|
@ -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, ...")
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
Loading…
Reference in New Issue