flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chiwanpark <...@git.apache.org>
Subject [GitHub] flink pull request: [FLINK-2613] Print usage information for Scala...
Date Thu, 08 Oct 2015 11:51:08 GMT
Github user chiwanpark commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1106#discussion_r41503568
  
    --- Diff: flink-staging/flink-scala-shell/src/main/scala/org/apache/flink/api/scala/FlinkShell.scala
---
    @@ -18,48 +18,74 @@
     
     package org.apache.flink.api.scala
     
    +import java.io.{StringWriter, BufferedReader}
    +
    +import org.apache.flink.api.common.ExecutionMode
    +
     import org.apache.flink.configuration.Configuration
     import org.apache.flink.runtime.minicluster.LocalFlinkMiniCluster
     
     import scala.tools.nsc.Settings
     
    +import scala.tools.nsc.interpreter._
    +
     
     object FlinkShell {
     
    +  object ExecutionMode extends Enumeration {
    +    val UNDEFINED, LOCAL, REMOTE = Value
    +  }
    +
    +  var bufferedReader: Option[BufferedReader] = None
    +
       def main(args: Array[String]) {
     
         // scopt, command line arguments
         case class Config(
             port: Int = -1,
             host: String = "none",
    -        externalJars: Option[Array[String]] = None)
    +        externalJars: Option[Array[String]] = None,
    +        flinkShellExecutionMode : ExecutionMode.Value = ExecutionMode.UNDEFINED)
    +
         val parser = new scopt.OptionParser[Config]("start-scala-shell.sh") {
           head ("Flink Scala Shell")
     
    -      opt[Int] ('p', "port") action {
    -        (x, c) =>
    -          c.copy (port = x)
    -      } text("port specifies port of running JobManager")
    -
    -      opt[(String)] ('h',"host") action {
    -        case (x, c) =>
    -          c.copy (host = x)
    -      }  text("host specifies host name of running JobManager")
    -
    -      opt[(String)] ('a',"addclasspath") action {
    -        case (x,c) =>
    -          val xArray = x.split(":")
    -          c.copy(externalJars = Option(xArray))
    -      } text("specifies additional jars to be used in Flink")
    -      
    -      help("help") text("prints this usage text")
    +      cmd("local") action {
    +        (_,c) => c.copy( host = "none", port = -1, flinkShellExecutionMode = ExecutionMode.LOCAL)
    +      } text("starts Flink scala shell with a local Flink cluster\n") children(
    +        opt[(String)] ("addclasspath") abbr("a") valueName("<path/to/jar>") action
{
    +          case (x,c) =>
    +            val xArray = x.split(":")
    +            c.copy(externalJars = Option(xArray))
    +          } text("specifies additional jars to be used in Flink\n")
    +        )
    +
    +      cmd("remote") action { (_, c) =>
    +        c.copy(flinkShellExecutionMode = ExecutionMode.REMOTE)
    +      } text("starts Flink scala shell connecting to a remote cluster\n") children(
    +        arg[String]("<host>") action { (h, c) =>
    +          c.copy(host = h) }
    +          text("remote host name as string"),
    +        arg[Int]("<port>") action { (p, c) =>
    +          c.copy(port = p) }
    +          text("remote port as integer\n"),
    +        opt[(String)] ("addclasspath") abbr("a")  valueName("<path/to/jar>") action
{
    --- End diff --
    
    Duplicated space between `abbr("a")` and `valueName`


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message