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

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


The following commit(s) were added to refs/heads/NLPCRAFT-168 by this push:
     new a8839c3  Update NCCli.scala
a8839c3 is described below

commit a8839c33ff8475359a77ff5c4821cef610bc319a
Author: Aaron Radzinski <[email protected]>
AuthorDate: Mon Nov 2 13:20:24 2020 -0800

    Update NCCli.scala
---
 .../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
index 1432ec9..c18c716 100644
--- 
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
+++ 
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala
@@ -43,6 +43,7 @@ import java.util.regex.Pattern
 import org.apache.commons.io.input.{ReversedLinesFileReader, Tailer, 
TailerListenerAdapter}
 import org.apache.commons.lang3.time.DurationFormatUtils
 import org.apache.http.util.EntityUtils
+import org.apache.nlpcraft.model.tools.sqlgen.impl.NCSqlModelGeneratorImpl
 import org.jline.builtins.Commands
 import org.jline.reader.{Candidate, Completer, EndOfFileException, 
Highlighter, LineReader, LineReaderBuilder, ParsedLine, UserInterruptException}
 import org.jline.reader.impl.DefaultParser
@@ -2247,6 +2248,20 @@ object NCCli extends App {
      * @param repl Whether or not executing from REPL.
      */
     private def cmdSqlGen(cmd: Command, args: Seq[Argument], repl: Boolean): 
Unit = {
+        val nativeArgs = args.map { arg ⇒
+            val param = arg.parameter.names.head
+
+            arg.value match {
+                case None ⇒ param
+                case Some(v) ⇒ s"$param=$v"
+            }
+        }
+
+        try
+            NCSqlModelGeneratorImpl.process(nativeArgs.toArray)
+        catch {
+            case e: Exception ⇒ error(e.getLocalizedMessage)
+        }
     }
 
     /**

Reply via email to