This is an automated email from the ASF dual-hosted git repository.

aradzinski pushed a commit to branch NLPCRAFT-108
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git


The following commit(s) were added to refs/heads/NLPCRAFT-108 by this push:
     new 73bb11a  WIP.
73bb11a is described below

commit 73bb11ad8c254063488e548e4b1b8a057b39361c
Author: Aaron Radzinski <[email protected]>
AuthorDate: Mon Aug 24 13:00:43 2020 -0700

    WIP.
---
 bin/nlpcraft.cmd                                   | 18 +++++
 bin/nlpcraft.sh                                    | 17 +++++
 .../model/tools/cmdline/NCCommandLine.scala        | 76 ++++++++++++++++++++++
 3 files changed, 111 insertions(+)

diff --git a/bin/nlpcraft.cmd b/bin/nlpcraft.cmd
new file mode 100644
index 0000000..9d5991d
--- /dev/null
+++ b/bin/nlpcraft.cmd
@@ -0,0 +1,18 @@
+@echo OFF
+
+rem
+rem Licensed to the Apache Software Foundation (ASF) under one or more
+rem contributor license agreements.  See the NOTICE file distributed with
+rem this work for additional information regarding copyright ownership.
+rem The ASF licenses this file to You under the Apache License, Version 2.0
+rem (the "License"); you may not use this file except in compliance with
+rem the License.  You may obtain a copy of the License at
+rem
+rem      http://www.apache.org/licenses/LICENSE-2.0
+rem
+rem Unless required by applicable law or agreed to in writing, software
+rem distributed under the License is distributed on an "AS IS" BASIS,
+rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+rem See the License for the specific language governing permissions and
+rem limitations under the License.
+rem
\ No newline at end of file
diff --git a/bin/nlpcraft.sh b/bin/nlpcraft.sh
new file mode 100644
index 0000000..fef112c
--- /dev/null
+++ b/bin/nlpcraft.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+#
+# 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.
+#
\ No newline at end of file
diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
index f6f8ca8..bd408ca 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
@@ -17,9 +17,85 @@
 
 package org.apache.nlpcraft.model.tools.cmdline
 
+import org.apache.nlpcraft.common.version.NCVersion
+
 /**
  * 'nlpcraft' script entry point.
  */
 object NCCommandLine extends App {
+    private final val NAME = "NLPCraft CLI"
+
+    case class Parameter(
+        names: Seq[String],
+        optional: Boolean = false,
+        desc: String
+    )
+    case class Command(
+        name: String,
+        desc: String,
+        params: Seq[Parameter] = Seq.empty,
+        examples: Seq[String] = Seq.empty,
+        body: (Seq[String]) => Unit
+    )
+
+    private final val CMDS = Seq(
+        Command(
+            name = "help",
+            desc = s"Displays manual page for $NAME.",
+            body = cmdHelp
+        ),
+        Command(
+            name = "version",
+            desc = s"Displays version of $NAME runtime.",
+            body = cmdVersion
+        ),
+        Command(
+            name = "repl",
+            desc = s"Starts '$NAME' in interactive REPL mode.",
+            body = cmdRepl
+        )
+    )
+
+    private final val HELP_CMD = CMDS.find(_.name == "help").get
+    private final val DFLT_CMD = CMDS.find(_.name == "repl").get
+
+    /**
+     *
+     * @param params
+     */
+    private def cmdHelp(params: Seq[String]): Unit = {
+
+    }
+
+    /**
+     *
+     * @param params
+     */
+    private def cmdRepl(params: Seq[String]): Unit = {
+
+    }
+
+    /**
+     *
+     * @param params
+     */
+    private def cmdVersion(params: Seq[String]): Unit = {
+        val curVer = NCVersion.getCurrent
+
+        log(s"$NAME ver. ${curVer.version} released on ${curVer.date}")
+    }
+
+    private def error(msg: String): Unit = System.err.println(msg)
+    private def log(msg: String): Unit = System.out.println(msg)
+
+    /**
+     *
+     * @param args
+     */
+    private def boot(args: Array[String]): Unit = {
+
+    }
 
+    // Boot up.
+    boot(args)
 }

Reply via email to