pan3793 commented on a change in pull request #826:
URL: https://github.com/apache/incubator-kyuubi/pull/826#discussion_r672235470



##########
File path: kyuubi-ctl/pom.xml
##########
@@ -109,6 +109,11 @@
             <version>${project.version}</version>
             <scope>test</scope>
         </dependency>
+
+        <dependency>
+            <groupId>com.beust</groupId>
+            <artifactId>jcommander</artifactId>
+        </dependency>

Review comment:
       put compile scope deps before thoes test scope

##########
File path: kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/KyuubiCli.scala
##########
@@ -0,0 +1,108 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl
+
+import scala.collection.JavaConverters._
+import scala.collection.mutable.HashMap
+
+import com.beust.jcommander.JCommander
+
+import org.apache.kyuubi.Logging
+import org.apache.kyuubi.ctl.ServiceType.ServiceType
+import org.apache.kyuubi.ctl.commands.common.{AbstractCommand, UnixStyleUsage}
+import org.apache.kyuubi.ctl.commands.engine._
+import org.apache.kyuubi.ctl.commands.server._
+
+private[ctl] object ServiceType extends Enumeration {
+  type ServiceType = Value
+  val SERVER, ENGINE = Value
+}
+
+class KyuubiCli extends Logging {
+
+  private lazy val commands = initCommands()
+
+  def initCommands(): HashMap[ServiceType, JCommander] = {
+    // init engine commands
+    val engineCommand = JCommander
+      .newBuilder()
+      .addCommand(new GetEngineCommand)
+      .addCommand(new DeleteEngineCommand)
+      .addCommand(new ListEngineCommand)
+      .build()
+
+    // init server commands
+    val serverCommand = JCommander
+      .newBuilder()
+      .addCommand(new CreateServerCommand)
+      .addCommand(new GetServerCommand)
+      .addCommand(new DeleteServerCommand)
+      .addCommand(new ListServerCommand)
+      .build()
+
+    // register commands
+    HashMap(
+      ServiceType.ENGINE -> engineCommand,
+      ServiceType.SERVER -> serverCommand
+    )
+  }

Review comment:
       simplify to 
   ```
   private lazy val commands: Map[ServiceType, JCommander] = Map(
       ServiceType.ENGINE -> JCommander.newBuilder
         .addCommand(new GetEngineCommand)
         .addCommand(new DeleteEngineCommand)
         .addCommand(new ListEngineCommand)
         .build,
   
       ServiceType.SERVER -> JCommander.newBuilder
         .addCommand(new CreateServerCommand)
         .addCommand(new GetServerCommand)
         .addCommand(new DeleteServerCommand)
         .addCommand(new ListServerCommand)
         .build
     )
   ```

##########
File path: 
kyuubi-ctl/src/main/scala/org/apache/kyuubi/ctl/commands/engine/ListEngineCommand.scala
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.kyuubi.ctl.commands.engine
+
+import com.beust.jcommander.{JCommander, Parameter, Parameters, 
UnixStyleUsageFormatter}
+
+import org.apache.kyuubi.ctl.commands.common.AbstractCommand
+
+@Parameters(commandNames = Array("list"))
+class ListEngineCommand extends AbstractCommand {
+
+  @Parameter(
+    names = Array("-zk", "--zk-quorum"),
+    description = "The connection string for the zookeeper ensemble, using zk 
quorum manually.",
+    order = 1)
+  var zkQuorum: String = _
+
+  @Parameter(
+    names = Array("-n", "--namespace"),
+    description = "The namespace, using kyuubi-defaults/conf if absent.",
+    order = 1)
+  var namespace: String = _
+
+  @Parameter(
+    names = Array("-s", "--host"),
+    description = "Hostname or IP address of a service.",
+    order = 1)

Review comment:
       all parameters use same`order` value?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to