You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by ar...@apache.org on 2020/12/20 07:33:15 UTC

[incubator-nlpcraft] branch master updated (c1f0c01 -> 7e9b74e)

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

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


    from c1f0c01  Test fix.
     new c06b053  Prep for 0.7.3 release.
     new d86c7c7  Merge branch 'master' of https://github.com/apache/incubator-nlpcraft
     new 39b1896  Various improvements.
     new a711f7e  WIP.
     new 4ff4bd6  WIP.
     new d073e1d  WIP on NLPCRAFT-201
     new 7e9b74e  Update NCCli.scala

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 README.md                                          |   4 +-
 nlpcraft-stanford/pom.xml                          |   2 +-
 nlpcraft/pom.xml                                   |   2 +-
 .../apache/nlpcraft/common/version/NCVersion.scala |   3 +-
 .../nlpcraft/model/tools/cmdline/NCCli.scala       | 686 +++++++++++----------
 .../model/tools/cmdline/NCCliCommands.scala        | 174 +++---
 .../sqlgen/impl/NCSqlModelGeneratorImpl.scala      |  14 +-
 openapi/nlpcraft_swagger.yml                       |   2 +-
 pom.xml                                            |   4 +-
 9 files changed, 454 insertions(+), 437 deletions(-)


[incubator-nlpcraft] 05/07: WIP.

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 4ff4bd6f31d5c7fd0f0759fd3ec6cc678e034a91
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Dec 19 16:51:53 2020 -0800

    WIP.
---
 .../nlpcraft/model/tools/cmdline/NCCli.scala       | 63 +++++++++-------------
 .../sqlgen/impl/NCSqlModelGeneratorImpl.scala      | 14 ++---
 2 files changed, 33 insertions(+), 44 deletions(-)

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 1e8dec6..9199479 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
@@ -153,6 +153,9 @@ object NCCli extends App {
     case class SplitError(index: Int)
         extends Exception
 
+    case class UnknownCommand(cmd: String)
+        extends IllegalArgumentException(s"Unknown command ${c("'" + cmd + "'")}, type ${c("'help'")} to get help.")
+
     case class NoLocalServer()
         extends IllegalStateException(s"Local server not found, use $C'start-server'$RST command to start one.")
 
@@ -1481,7 +1484,7 @@ object NCCli extends App {
                     case None ⇒
                         err = true
 
-                        errorUnknownCommand(cmdName)
+                        throw UnknownCommand(cmdName)
                 }
             }
 
@@ -2646,7 +2649,7 @@ object NCCli extends App {
         exitStatus = 1
 
         if (msg != null && msg.nonEmpty)
-            logln(s"${y("ERR:")} ${if (msg.head.isLower) msg.head.toUpper + msg.tail else msg}")
+            logln(s"${r("X")} ${if (msg.head.isLower) msg.head.toUpper + msg.tail else msg}")
     }
 
     /**
@@ -2655,7 +2658,7 @@ object NCCli extends App {
      */
     private def warn(msg: String = ""): Unit =
         if (msg != null && msg.nonEmpty)
-            logln(s"${y("WRN:")} ${if (msg.head.isLower) msg.head.toUpper + msg.tail else msg}")
+            logln(s"${y("!")} ${if (msg.head.isLower) msg.head.toUpper + msg.tail else msg}")
 
     /**
      *
@@ -2676,16 +2679,6 @@ object NCCli extends App {
     }
 
     /**
-     *
-     */
-    private def errorUnknownCommand(cmd: String): Unit = {
-        val c2 = c(s"'$cmd'")
-        val h2 = c(s"'help'")
-
-        error(s"Unknown command $c2, type $h2 to get help.")
-    }
-
-    /**
      * Prints out the version and copyright title header.
      */
     private def title(): Unit = {
@@ -2947,40 +2940,34 @@ object NCCli extends App {
     @throws[Exception]
     private def doCommand(args: Seq[String], repl: Boolean): Unit = {
         if (args.nonEmpty) {
-            if (args.head.head == '$') {
-                val head = args.head.tail.trim // Remove '$' from 1st argument.
-                val tail = args.tail.toList
+            try
+                if (args.head.head == '$') {
+                    val head = args.head.tail.trim // Remove '$' from 1st argument.
+                    val tail = args.tail.toList
 
-                try
                     execOsCmd(if (head.isEmpty) tail else head :: tail)
-                catch {
-                    case e: Exception ⇒ error(e.getLocalizedMessage)
                 }
-            }
-            else {
-                // Process 'no-ansi' and 'ansi' commands first.
-                processAnsi(args, repl)
-
-                // Remove 'no-ansi' and 'ansi' commands from the argument list, if any.
-                val xargs = args.filter(arg ⇒ arg != NO_ANSI_CMD.name && arg != ANSI_CMD.name)
+                else {
+                    // Process 'no-ansi' and 'ansi' commands first.
+                    processAnsi(args, repl)
 
-                if (xargs.nonEmpty) {
-                    val cmd = xargs.head
+                    // Remove 'no-ansi' and 'ansi' commands from the argument list, if any.
+                    val xargs = args.filter(arg ⇒ arg != NO_ANSI_CMD.name && arg != ANSI_CMD.name)
 
-                    CMDS.find(_.name == cmd) match {
-                        case Some(cmd) ⇒
-                            // Reset error code.
-                            exitStatus = 0
+                    if (xargs.nonEmpty) {
+                        val cmd = xargs.head
 
-                            try
-                                cmd.body(cmd, processParameters(cmd, xargs.tail), repl)
-                            catch {
-                                case e: Exception ⇒ error(e.getLocalizedMessage)
-                            }
+                        // Reset error code.
+                        exitStatus = 0
 
-                        case None ⇒ errorUnknownCommand(cmd)
+                        CMDS.find(_.name == cmd) match {
+                            case Some(cmd) ⇒ cmd.body(cmd, processParameters(cmd, xargs.tail), repl)
+                            case None ⇒ throw UnknownCommand(cmd)
+                        }
                     }
                 }
+            catch {
+                case e: Exception ⇒ error(e.getLocalizedMessage)
             }
         }
     }
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/sqlgen/impl/NCSqlModelGeneratorImpl.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/sqlgen/impl/NCSqlModelGeneratorImpl.scala
index bba6708..0b66262 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/sqlgen/impl/NCSqlModelGeneratorImpl.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/sqlgen/impl/NCSqlModelGeneratorImpl.scala
@@ -451,6 +451,7 @@ object NCSqlModelGeneratorImpl {
       * @param col
       * @return
       */
+    //noinspection SameParameterValue
     private def getString(rs: ResultSet, col: String): String =
         Try(rs.getString(col)).getOrElse("No data")
 
@@ -459,6 +460,7 @@ object NCSqlModelGeneratorImpl {
       * @param col
       * @return
       */
+    //noinspection SameParameterValue
     private def getInt(rs: ResultSet, col: String): Int =
         Try(rs.getInt(col)).getOrElse(-1)
 
@@ -633,13 +635,13 @@ object NCSqlModelGeneratorImpl {
                |    ${c("--password|-w")} ${g("password")}
                |        Optional database user password.
                |
-               |    ${c("--model-id|-x")} ${g("id")}
+               |    ${c("--mdlId|-m")} ${g("id")}
                |        Optional generated model ID. By default, the model ID will be 'sql.model.id'.
                |
-               |    ${c("--model-ver|-v")} ${g("version")}
+               |    ${c("--mdlVer|-v")} ${g("version")}
                |        Optional generated model version. By default, the model version will be '1.0.0-timestamp'.
                |
-               |    ${c("--model-name|-n")} ${g("name")}
+               |    ${c("--mdlName|-n")} ${g("name")}
                |        Optional generated model name. By default, the model name will be 'SQL-based model'.
                |
                |    ${c("--exclude|-e")} ${g("list")}
@@ -773,9 +775,9 @@ object NCSqlModelGeneratorImpl {
                     case "--user" | "-u" ⇒ params.user = v
                     case "--password" | "-w" ⇒ params.password = v
                     case "--schema" | "-s" ⇒ params.schema = v
-                    case "--model-id" | "-x" ⇒ params.modelId = v
-                    case "--model-name" | "-n" ⇒ params.modelName = v
-                    case "--model-ver" | "-v" ⇒ params.modelVer = v
+                    case "--mdlId" | "-m" ⇒ params.modelId = v
+                    case "--mdlName" | "-n" ⇒ params.modelName = v
+                    case "--mdlVer" | "-v" ⇒ params.modelVer = v
                     case "--out" | "-o" ⇒ params.output = v
                     case "--include" | "-i" ⇒ params.inclSpec = v; params.inclPred = mkPredicate(v)
                     case "--exclude" | "-e" ⇒ params.exclSpec = v; params.exclPred = mkPredicate(v)


[incubator-nlpcraft] 01/07: Prep for 0.7.3 release.

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c06b053df47df6716da686ad465e20fe46bdf589
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Dec 17 20:14:16 2020 -0800

    Prep for 0.7.3 release.
---
 README.md                                                             | 4 ++--
 nlpcraft-stanford/pom.xml                                             | 2 +-
 nlpcraft/pom.xml                                                      | 2 +-
 .../src/main/scala/org/apache/nlpcraft/common/version/NCVersion.scala | 3 ++-
 openapi/nlpcraft_swagger.yml                                          | 2 +-
 pom.xml                                                               | 4 ++--
 6 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md
index 575b741..a1bf832 100644
--- a/README.md
+++ b/README.md
@@ -101,11 +101,11 @@ Add NLPCraft dependency to your project:
     <dependency>
         <groupId>org.apache.nlpcraft</groupId>
         <artifactId>nlpcraft</artifactId>
-        <version>0.7.2</version>
+        <version>0.7.3</version>
     </dependency>
 </dependencies>
 ```
-NOTE: **0.7.2** should be the latest NLPCraft version.
+NOTE: **0.7.3** should be the latest NLPCraft version.
 
 ### Define Data Model
 Declare the static part of the data model using YAML which we will later load in our model implementation. You can declare entire
diff --git a/nlpcraft-stanford/pom.xml b/nlpcraft-stanford/pom.xml
index b2f1d95..c44d738 100644
--- a/nlpcraft-stanford/pom.xml
+++ b/nlpcraft-stanford/pom.xml
@@ -27,7 +27,7 @@
     <parent>
         <groupId>org.apache.nlpcraft</groupId>
         <artifactId>nlpcraft-parent</artifactId>
-        <version>0.7.2</version>
+        <version>0.7.3</version>
         <relativePath>../</relativePath>
     </parent>
 
diff --git a/nlpcraft/pom.xml b/nlpcraft/pom.xml
index 6be99be..6b18e39 100644
--- a/nlpcraft/pom.xml
+++ b/nlpcraft/pom.xml
@@ -32,7 +32,7 @@
     <parent>
         <groupId>org.apache.nlpcraft</groupId>
         <artifactId>nlpcraft-parent</artifactId>
-        <version>0.7.2</version>
+        <version>0.7.3</version>
         <relativePath>../pom.xml</relativePath>
     </parent>
 
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/version/NCVersion.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/version/NCVersion.scala
index cc3ae4f..31a8812 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/version/NCVersion.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/version/NCVersion.scala
@@ -52,7 +52,8 @@ object NCVersion extends LazyLogging {
         Version("0.6.2", LocalDate.of(2020, 7, 9)),
         Version("0.7.0", LocalDate.of(2020, 9, 29)),
         Version("0.7.1", LocalDate.of(2020, 10, 29)),
-        Version("0.7.2", LocalDate.of(2020, 11, 19))
+        Version("0.7.2", LocalDate.of(2020, 11, 19)),
+        Version("0.7.3", LocalDate.of(2020, 12, 19))
     ).sortBy(_.version)
     // +=================================================+
     // | UPDATE THIS SEQUENCE FOR EACH RELEASE MANUALLY. |
diff --git a/openapi/nlpcraft_swagger.yml b/openapi/nlpcraft_swagger.yml
index bff623c..f497831 100644
--- a/openapi/nlpcraft_swagger.yml
+++ b/openapi/nlpcraft_swagger.yml
@@ -21,7 +21,7 @@ info:
     REST API for <a href="https://nlpcraft.apache.org">Apache NLPCraft</a> - an open source library for
     adding Natural Language Interface to any applications. For Data Model APIs see
     <a href="https://nlpcraft.apache.org/apis/latest/index.html">Javadoc</a> documentation.
-  version: 0.7.2
+  version: 0.7.3
   title: Apache NLPCraft API
 host: localhost:8081
 basePath: /api/v1
diff --git a/pom.xml b/pom.xml
index 10ad8e8..570e262 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
     <name>NLPCraft Parent</name>
     <groupId>org.apache.nlpcraft</groupId>
     <artifactId>nlpcraft-parent</artifactId>
-    <version>0.7.2</version>
+    <version>0.7.3</version>
     <packaging>pom</packaging>
 
     <url>https://nlpcraft.apache.org</url>
@@ -67,7 +67,7 @@
         <connection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</connection>
         <developerConnection>scm:git:ssh://git@github.com/apache/incubator-nlpcraft.git</developerConnection>
         <!-- Set actual tag name here -->
-        <tag>v0.7.2</tag>
+        <tag>v0.7.3</tag>
     </scm>
 
     <properties>


[incubator-nlpcraft] 04/07: WIP.

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit a711f7eadbf0335b105733e6077ea7f470909a65
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Dec 19 16:14:44 2020 -0800

    WIP.
---
 .../main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCli.scala    | 2 +-
 .../scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

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 17126b0..1e8dec6 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
@@ -1381,7 +1381,7 @@ object NCCli extends App {
                         if (param.value.isDefined)
                             T___ + param.names.zip(Stream.continually(param.value.get)).map(t ⇒ s"${t._1}=${t._2}").mkString(", ")
                         else
-                            s"$T___${param.names.mkString(",")}"
+                            s"$T___${param.names.mkString(", ")}"
 
                     lines += c(line)
 
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
index 2d2b216..72c0c92 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
@@ -637,7 +637,7 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "noWait",
-                    names = Seq("--noWait"),
+                    names = Seq("--noWait", "-w"),
                     optional = true,
                     desc =
                         s"Instructs command not to wait for the server startup and return immediately."
@@ -719,7 +719,7 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "noWait",
-                    names = Seq("--noWait"),
+                    names = Seq("--noWait", "-w"),
                     optional = true,
                     desc =
                         s"Instructs command not to wait for the probe startup and return immediately."


[incubator-nlpcraft] 07/07: Update NCCli.scala

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 7e9b74ea051447861f61ddc38055f0bd4744bb05
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Dec 19 23:33:00 2020 -0800

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

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 181fc07..1fc88bb 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
@@ -95,7 +95,7 @@ object NCCli extends App {
     private final val DFLT_USER_PASSWD = "admin"
 
     private final val VER = NCVersion.getCurrent
-    private final val CP_WIN_NIX_SEPS = ":;"
+    private final val CP_WIN_NIX_SEPS_REGEX = "[:;]"
     private final val CP_SEP = File.pathSeparator
     private final val JAVA = U.sysEnv("NLPCRAFT_CLI_JAVA").getOrElse(new File(SystemUtils.getJavaHome, s"bin/java${if (SystemUtils.IS_OS_UNIX) "" else ".exe"}").getAbsolutePath)
     private final val USR_WORK_DIR = SystemUtils.USER_DIR
@@ -441,7 +441,7 @@ object NCCli extends App {
      * @return
      */
     private def normalizeCp(cp: String): String =
-        U.splitTrimFilter(cp, CP_WIN_NIX_SEPS).map(refinePath).map(path ⇒ {
+        U.splitTrimFilter(cp, CP_WIN_NIX_SEPS_REGEX).map(refinePath).map(path ⇒ {
             val normPath = refinePath(path)
 
             if (!normPath.contains("*") && !new File(normPath).exists())
@@ -661,10 +661,14 @@ object NCCli extends App {
 
                 if (!online) {
                     logln(r(" [Error]"))
-                    error(s"Server start failed, check for errors: ${c(output.getAbsolutePath)}")
+
+                    error(s"Server start failed, check full log for errors: ${c(output.getAbsolutePath)}")
+
+                    tailFile(output.getAbsolutePath, 20)
                 }
                 else {
                     logln(g(" [OK]"))
+
                     logServerInfo(beacon)
 
                     showTip()
@@ -926,10 +930,14 @@ object NCCli extends App {
 
                 if (beacon == null) {
                     logln(r(" [Error]"))
-                    error(s"Probe start failed, check for errors: ${c(output.getAbsolutePath)}")
+
+                    error(s"Probe start failed, check full log for errors: ${c(output.getAbsolutePath)}")
+
+                    tailFile(output.getAbsolutePath, 20)
                 }
                 else {
                     logln(g(" [OK]"))
+
                     logProbeInfo(beacon)
 
                     showTip()


[incubator-nlpcraft] 02/07: Merge branch 'master' of https://github.com/apache/incubator-nlpcraft

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d86c7c7844769c43fadeb3b6b98531e5b073b4ae
Merge: c06b053 c1f0c01
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Dec 19 10:56:44 2020 -0800

    Merge branch 'master' of https://github.com/apache/incubator-nlpcraft

 .../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala    | 14 ++++++++++++--
 .../nlpcraft/server/nlp/enrichers/date/NCDateParser.scala  |  8 ++++----
 2 files changed, 16 insertions(+), 6 deletions(-)


[incubator-nlpcraft] 06/07: WIP on NLPCRAFT-201

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit d073e1de2374a517a8f048b602d948a9ee5f0897
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Dec 19 23:12:47 2020 -0800

    WIP on NLPCRAFT-201
---
 .../nlpcraft/model/tools/cmdline/NCCli.scala       | 122 ++++++++++-----------
 .../model/tools/cmdline/NCCliCommands.scala        |   7 +-
 2 files changed, 62 insertions(+), 67 deletions(-)

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 9199479..181fc07 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
@@ -23,7 +23,7 @@ import java.lang.management.ManagementFactory
 import java.nio.charset.StandardCharsets
 import java.nio.file.Paths
 import java.text.DateFormat
-import java.util
+import java.{lang, util}
 import java.util.Date
 import java.util.regex.Pattern
 import java.util.zip.ZipInputStream
@@ -168,6 +168,9 @@ object NCCli extends App {
             s"type $C'help --cmd=${cmd.name}'$RST to get help."
         )
 
+    case class NotSignedIn()
+        extends IllegalStateException(s"Not signed in. Use ${c("'signin'")} command to sign in first.")
+
     case class MissingMandatoryJsonParameters(cmd: Command, missingParams: Seq[RestSpecParameter], path: String)
         extends IllegalArgumentException(
             s"Missing mandatory JSON parameters (${missingParams.map(s ⇒ y(s.name)).mkString(",")}) " +
@@ -370,17 +373,20 @@ object NCCli extends App {
      * @param id
      * @return
      */
-    private def getPathParam(cmd: Command, args: Seq[Argument], id: String): String =
-        getParamOpt(cmd, args, id) match {
-            case Some(path) ⇒
-                val normPath = refinePath(stripQuotes(path))
+    private def getPathParam(cmd: Command, args: Seq[Argument], id: String, dflt: String = null): String = {
+        def makePath(p: String): String = {
+            val normPath = refinePath(stripQuotes(p))
 
-                checkFilePath(normPath)
+            checkFilePath(normPath)
 
-                normPath
+            normPath
+        }
 
-            case None ⇒ null
+        getParamOpt(cmd, args, id) match {
+            case Some(path) ⇒ makePath(path)
+            case None ⇒ if (dflt == null) null else makePath(dflt)
         }
+    }
 
     /**
      *
@@ -1677,7 +1683,7 @@ object NCCli extends App {
                        |""".stripMargin
                 )
 
-            case Some(_) ⇒ warn(s"Already signed in. See ${c("'signout'")} command.")
+            case Some(_) ⇒ warn(s"Already signed in. Use ${c("'signout'")} command to sign out first, if necessary.")
         }
 
     /**
@@ -1697,7 +1703,7 @@ object NCCli extends App {
                        |""".stripMargin
                 )
 
-            case None ⇒ error(s"Not signed in. See ${c("'signin'")} command.")
+            case None ⇒ throw NotSignedIn()
         }
 
     /**
@@ -1735,11 +1741,7 @@ object NCCli extends App {
             }
         }
 
-        try
-            NCSqlModelGeneratorImpl.process(repl = true, nativeArgs.toArray)
-        catch {
-            case e: Exception ⇒ error(e.getLocalizedMessage)
-        }
+        NCSqlModelGeneratorImpl.process(repl = true, nativeArgs.toArray)
     }
 
     /**
@@ -1766,7 +1768,7 @@ object NCCli extends App {
                        |""".stripMargin
                 )
 
-            case None ⇒ error(s"Not signed in. See ${c("'signin'")} command.")
+            case None ⇒ throw NotSignedIn()
         }
 
     /**
@@ -1797,7 +1799,7 @@ object NCCli extends App {
                        |""".stripMargin
                 )
 
-            case None ⇒ error(s"Not signed in. See ${c("'signin'")} command.")
+            case None ⇒ throw NotSignedIn()
         }
 
     /**
@@ -2000,24 +2002,22 @@ object NCCli extends App {
       * @param repl Whether or not executing from REPL.
       */
     private [cmdline] def cmdGenModel(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val filePath = refinePath(getParam(cmd, args, "filePath"))
-        val overrideFlag = getParam(cmd, args,"override", "false").toLowerCase
-        val mdlId = getParam(cmd, args,"mdlId")
-
-        checkSupported(cmd,"overrideFlag", overrideFlag, "true", "false")
+        val filePath = getPathParam(cmd, args, "filePath")
+        val overrideFlag = getFlagParam(cmd, args, "override", false)
+        val mdlId = getParam(cmd, args, "modelId")
 
         val out = new File(filePath)
 
         if (out.isDirectory)
-            throw new NCE(s"Invalid file path: ${c(out.getAbsolutePath)}")
+            throw new IllegalArgumentException(s"Invalid file path: ${c(out.getAbsolutePath)}")
 
         if (out.exists()) {
-            if (overrideFlag == "true") {
+            if (overrideFlag) {
                 if (!out.delete())
-                    throw new NCE(s"Couldn't delete file: ${c(out.getAbsolutePath)}")
+                    throw new IllegalArgumentException(s"Couldn't delete file: ${c(out.getAbsolutePath)}")
             }
             else
-                throw new NCE(s"File already exists: ${c(out.getAbsolutePath)}")
+                throw new IllegalArgumentException(s"File already exists: ${c(out.getAbsolutePath)}")
         }
 
         val (fileExt, extractHdr) = {
@@ -2028,7 +2028,7 @@ object NCCli extends App {
             else if (lc.endsWith(".json") || lc.endsWith(".js"))
                 ("json", extractJsonHeader _)
             else
-                throw new NCE(s"Unsupported model file type (extension): ${c(filePath)}")
+                throw new IllegalArgumentException(s"Unsupported model file type (extension): ${c(filePath)}")
         }
 
         copy(
@@ -2050,13 +2050,14 @@ object NCCli extends App {
       * @param repl Whether or not executing from REPL.
       */
     private [cmdline] def cmdGenProject(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val outputDir = refinePath(getParam(cmd, args, "outputDir", "."))
-        val baseName = getParam(cmd, args,"baseName")
-        val lang = getParam(cmd, args,"lang", "java").toLowerCase
-        val buildTool = getParam(cmd, args,"buildTool", "mvn").toLowerCase
-        val pkgName = getParam(cmd, args,"packageName", "org.apache.nlpcraft.demo").toLowerCase
-        val fileType = getParam(cmd, args,"modelType", "yaml").toLowerCase
-        val overrideFlag = getParam(cmd, args,"override", "false").toLowerCase
+        val outputDir = getPathParam(cmd, args, "outputDir", USR_WORK_DIR)
+        val baseName = getParam(cmd, args, "baseName")
+        val lang = getParam(cmd, args, "lang", "java").toLowerCase
+        val buildTool = getParam(cmd, args, "buildTool", "mvn").toLowerCase
+        val pkgName = getParam(cmd, args, "packageName", "org.apache.nlpcraft.demo").toLowerCase
+        val fileType = getParam(cmd, args, "modelType", "yaml").toLowerCase
+        val overrideFlag = getFlagParam(cmd, args, "override", false)
+
         val dst = new File(outputDir, baseName)
         val pkgDir = pkgName.replaceAll("\\.", "/")
         val clsName = s"${baseName.head.toUpper}${baseName.tail}"
@@ -2065,9 +2066,8 @@ object NCCli extends App {
         val isJson = fileType == "json" || fileType == "js"
 
         checkSupported(cmd, "lang", lang, "java", "scala", "kotlin")
-        checkSupported(cmd,"buildTool", buildTool, "mvn", "gradle", "sbt")
-        checkSupported(cmd,"fileType", fileType, "yaml", "yml", "json", "js")
-        checkSupported(cmd,"override", overrideFlag, "true", "false")
+        checkSupported(cmd, "buildTool", buildTool, "mvn", "gradle", "sbt")
+        checkSupported(cmd, "fileType", fileType, "yaml", "yml", "json", "js")
 
         def checkJavaName(v: String, name: String): Unit =
             if (!SourceVersion.isName(v))
@@ -2078,17 +2078,17 @@ object NCCli extends App {
 
         // Prepares output folder.
         if (dst.isFile)
-            throw new NCE(s"Invalid folder: ${c(dst.getAbsolutePath)}")
+            throw new IllegalArgumentException(s"Invalid output folder: ${c(dst.getAbsolutePath)}")
         else {
             if (!dst.exists()) {
                 if (!dst.mkdirs())
-                    throw new NCE(s"Couldn't create folder: ${c(dst.getAbsolutePath)}")
+                    throw new IllegalArgumentException(s"Failed to create folder: ${c(dst.getAbsolutePath)}")
             }
             else {
-                if (overrideFlag == "true")
+                if (overrideFlag)
                     U.clearFolder(dst.getAbsolutePath)
                 else
-                    throw new NCE(s"Folder already exists: ${c(dst.getAbsolutePath)}")
+                    throw new IllegalArgumentException(s"Folder already exists: ${c(dst.getAbsolutePath)}")
             }
         }
 
@@ -2222,18 +2222,18 @@ object NCCli extends App {
                 case "scala-gradle" ⇒ cpCommon("scala", "scala"); cpGradle()
                 case "scala-sbt" ⇒ cpCommon("scala", "scala"); cpSbt()
 
-                case _ ⇒ throw new NCE(s"Unsupported combination of '${c(lang)}' and '${c(buildTool)}'.")
+                case _ ⇒ throw new IllegalArgumentException(s"Unsupported combination of '${c(lang)}' and '${c(buildTool)}'.")
             }
 
             logln(s"Project created: ${c(dst.getCanonicalPath)}")
             logln(folder2String(dst))
         }
         catch {
-            case e: NCE ⇒
+            case e: Exception ⇒
                 try
                     U.clearFolder(dst.getAbsolutePath, delFolder = true)
                 catch {
-                    case _: NCE ⇒ // No-op.
+                    case _: Exception ⇒ // No-op.
                 }
 
                 throw e
@@ -2532,9 +2532,9 @@ object NCCli extends App {
         )
 
         logln()
-        logln(s"${y("\uD83D\uDCA1")} Hit ${rv(bo(" Tab "))} for auto suggestions and completion.")
-        logln(s"   Type '${c("help")}' to get help and ${rv(bo(" ↑ "))} or ${rv(bo(" ↓ "))} to scroll through history.")
-        logln(s"   Type '${c("quit")}' to exit.")
+        logln(s"${y("Tip:")} Hit ${rv(bo(" Tab "))} for auto suggestions and completion.")
+        logln(s"     Type '${c("help")}' to get help and ${rv(bo(" ↑ "))} or ${rv(bo(" ↓ "))} to scroll through history.")
+        logln(s"     Type '${c("quit")}' to exit.")
 
         var exit = false
 
@@ -2617,28 +2617,22 @@ object NCCli extends App {
      * @param args Arguments, if any, for this command.
      * @param repl Whether or not executing from REPL.
      */
-    private [cmdline] def cmdVersion(cmd: Command, args: Seq[Argument], repl: Boolean): Unit =
-        if (args.isEmpty)
+    private [cmdline] def cmdVersion(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
+        val isS = getFlagParam(cmd, args, "semver", dflt = false)
+        val isD = getFlagParam(cmd, args, "reldate", dflt = false)
+
+        if (!isS && !isD)
             logln((
                 new NCAsciiTable
                     += ("Version:", c(VER.version))
                     += ("Release date:", c(VER.date.toString))
                 ).toString
             )
-        else {
-            val isS = args.exists(_.parameter.id == "semver")
-            val isD = args.exists(_.parameter.id == "reldate")
-
-            if (isS || isD) {
-                if (isS)
-                    logln(s"${VER.version}")
-                if (isD)
-                    logln(s"${VER.date}")
-            }
-            else
-                error(s"Invalid parameters: ${args.mkString(", ")}")
-        }
-
+        else if (isS)
+            logln(s"${VER.version}")
+        else
+            logln(s"${VER.date}")
+    }
 
     /**
      *
@@ -2866,7 +2860,7 @@ object NCCli extends App {
         args.map { arg ⇒
             val parts = arg.split("=")
 
-            def mkError() = new IllegalArgumentException(s"Invalid parameter: ${c(arg)}")
+            def mkError() = new IllegalArgumentException(s"Invalid parameter: ${c(arg)}, type $C'help --cmd=${cmd.name}'$RST to get help.")
 
             if (parts.size > 2)
                 throw mkError()
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
index 72c0c92..1aab9bf 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
@@ -950,7 +950,10 @@ private [cmdline] object NCCliCommands {
         Command(
             name = "quit",
             group = "3. Miscellaneous",
-            synopsis = s"Quits REPL mode. Note that started server and probe, if any, will remain running.",
+            synopsis = s"Quits REPL mode.",
+            desc = Some(
+                s" Note that started server and probe, if any, will remain running."
+            ),
             body = NCCli.cmdQuit
         ),
         Command(
@@ -1000,14 +1003,12 @@ private [cmdline] object NCCliCommands {
                 Parameter(
                     id = "semver",
                     names = Seq("--semVer", "-s"),
-                    value = None,
                     optional = true,
                     desc = s"Display only the semantic version value, e.g. ${VER.version}."
                 ),
                 Parameter(
                     id = "reldate",
                     names = Seq("--relDate", "-d"),
-                    value = None,
                     optional = true,
                     desc = s"Display only the release date, e.g. ${VER.date}."
                 )


[incubator-nlpcraft] 03/07: Various improvements.

Posted by ar...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 39b18968fe7cf63d0b52931142be1e6a719b846f
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Sat Dec 19 16:10:57 2020 -0800

    Various improvements.
---
 .../nlpcraft/model/tools/cmdline/NCCli.scala       | 521 +++++++++++----------
 .../model/tools/cmdline/NCCliCommands.scala        | 167 +++----
 2 files changed, 356 insertions(+), 332 deletions(-)

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 ee8fd55..17126b0 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
@@ -94,20 +94,21 @@ object NCCli extends App {
     private final val DFLT_USER_EMAIL = "admin@admin.com"
     private final val DFLT_USER_PASSWD = "admin"
 
-    private final lazy val VER = NCVersion.getCurrent
-    private final lazy val JAVA = U.sysEnv("NLPCRAFT_CLI_JAVA").getOrElse(new File(SystemUtils.getJavaHome, s"bin/java${if (SystemUtils.IS_OS_UNIX) "" else ".exe"}").getAbsolutePath)
-    private final lazy val INSTALL_HOME = U.sysEnv("NLPCRAFT_CLI_INSTALL_HOME").getOrElse(SystemUtils.USER_DIR)
-    private final lazy val WORK_DIR = Paths.get("").toAbsolutePath.toString
-    private final lazy val JAVA_CP = U.sysEnv("NLPCRAFT_CLI_CP").getOrElse(ManagementFactory.getRuntimeMXBean.getClassPath)
-    private final lazy val SCRIPT_NAME = U.sysEnv("NLPCRAFT_CLI_SCRIPT").getOrElse(s"nlpcraft.${if (SystemUtils.IS_OS_UNIX) "sh" else "cmd"}")
-    private final lazy val PROMPT = if (SCRIPT_NAME.endsWith("cmd")) ">" else "$"
-    private final lazy val IS_SCRIPT = U.sysEnv("NLPCRAFT_CLI").isDefined
-
+    private final val VER = NCVersion.getCurrent
+    private final val CP_WIN_NIX_SEPS = ":;"
+    private final val CP_SEP = File.pathSeparator
+    private final val JAVA = U.sysEnv("NLPCRAFT_CLI_JAVA").getOrElse(new File(SystemUtils.getJavaHome, s"bin/java${if (SystemUtils.IS_OS_UNIX) "" else ".exe"}").getAbsolutePath)
+    private final val USR_WORK_DIR = SystemUtils.USER_DIR
+    private final val USR_HOME_DIR = SystemUtils.USER_HOME
+    private final val INSTALL_HOME = U.sysEnv("NLPCRAFT_CLI_INSTALL_HOME").getOrElse(USR_WORK_DIR)
+    private final val JAVA_CP = U.sysEnv("NLPCRAFT_CLI_CP").getOrElse(ManagementFactory.getRuntimeMXBean.getClassPath)
+    private final val SCRIPT_NAME = U.sysEnv("NLPCRAFT_CLI_SCRIPT").getOrElse(s"nlpcraft.${if (SystemUtils.IS_OS_UNIX) "sh" else "cmd"}")
+    private final val PROMPT = if (SCRIPT_NAME.endsWith("cmd")) ">" else "$"
+    private final val IS_SCRIPT = U.sysEnv("NLPCRAFT_CLI").isDefined
     private final val T___ = "    "
-    private val OPEN_BRK = Seq('[', '{', '(')
-    private val CLOSE_BRK = Seq(']', '}', ')')
-    // Pair for each open or close bracket.
-    private val BRK_PAIR = OPEN_BRK.zip(CLOSE_BRK).toMap ++ CLOSE_BRK.zip(OPEN_BRK).toMap
+    private final val OPEN_BRK = Seq('[', '{', '(')
+    private final val CLOSE_BRK = Seq(']', '}', ')')
+    private final val BRK_PAIR = OPEN_BRK.zip(CLOSE_BRK).toMap ++ CLOSE_BRK.zip(OPEN_BRK).toMap // Pair for each open or close bracket.
 
     private var exitStatus = 0
 
@@ -270,6 +271,125 @@ object NCCli extends App {
     private final val STOP_PRB_CMD = CMDS.find(_.name == "stop-probe").get
 
     /**
+     * @param cmd
+     * @param args
+     * @param id
+     * @param dflt
+     */
+    @throws[MissingParameter]
+    private def getParam(cmd: Command, args: Seq[Argument], id: String, dflt: String = null): String =
+        args.find(_.parameter.id == id).flatMap(_.value) match {
+            case Some(v) ⇒ v
+            case None ⇒
+                if (dflt == null)
+                    throw MissingParameter(cmd, id)
+
+                dflt
+        }
+
+    @throws[InvalidParameter]
+    private def getIntParam(cmd: Command, args: Seq[Argument], id: String, dflt: Int): Int = {
+        getParamOpt(cmd, args, id) match {
+            case Some(num) ⇒
+                try
+                    Integer.parseInt(num)
+                catch {
+                    case _: Exception ⇒ throw InvalidParameter(cmd, id)
+                }
+
+            case None ⇒ dflt // Default.
+        }
+    }
+
+    @throws[InvalidParameter]
+    private def getDoubleParam(cmd: Command, args: Seq[Argument], id: String, dflt: Double): Double = {
+        getParamOpt(cmd, args, id) match {
+            case Some(num) ⇒
+                try
+                    java.lang.Double.parseDouble(num)
+                catch {
+                    case _: Exception ⇒ throw InvalidParameter(cmd, id)
+                }
+
+            case None ⇒ dflt // Default.
+        }
+    }
+
+    /**
+     * @param cmd
+     * @param args
+     * @param id
+     */
+    private def getParamOpt(cmd: Command, args: Seq[Argument], id: String): Option[String] =
+        args.find(_.parameter.id == id).flatMap(_.value)
+
+    /**
+     * @param cmd
+     * @param args
+     * @param id
+     */
+    private def getParamOrNull(cmd: Command, args: Seq[Argument], id: String): String =
+        args.find(_.parameter.id == id) match {
+            case Some(arg) ⇒ stripQuotes(arg.value.get)
+            case None ⇒ null
+        }
+
+    /**
+     *
+     * @param cmd
+     * @param args
+     * @param id
+     * @return
+     */
+    private def getFlagParam(cmd: Command, args: Seq[Argument], id: String, dflt: Boolean): Boolean =
+        args.find(_.parameter.id == id) match {
+            case Some(b) ⇒ true
+            case None ⇒ dflt
+        }
+
+    /**
+     *
+     * @param cmd
+     * @param args
+     * @param id
+     * @return
+     */
+    private def getCpParam(cmd: Command, args: Seq[Argument], id: String): String =
+        getParamOpt(cmd, args, id) match {
+            case Some(path) ⇒ normalizeCp(stripQuotes(path))
+            case None ⇒ null
+        }
+
+    /**
+     *
+     * @param cmd
+     * @param args
+     * @param id
+     * @return
+     */
+    private def getPathParam(cmd: Command, args: Seq[Argument], id: String): String =
+        getParamOpt(cmd, args, id) match {
+            case Some(path) ⇒
+                val normPath = refinePath(stripQuotes(path))
+
+                checkFilePath(normPath)
+
+                normPath
+
+            case None ⇒ null
+        }
+
+    /**
+     *
+     * @param path
+     */
+    private def refinePath(path: String): String = {
+        require(path != null)
+
+        if (path.nonEmpty && path.head == '~') new File(SystemUtils.getUserHome, path.tail).getAbsolutePath else path
+    }
+
+    /**
      *
      * @param s
      * @return
@@ -286,6 +406,59 @@ object NCCli extends App {
 
     /**
      *
+     * @param path
+     */
+    private def checkFilePath(path: String): Unit = {
+        val file = new File(path)
+
+        if (!file.exists() || !file.isFile)
+            throw new IllegalArgumentException(s"File not found: ${c(file.getAbsolutePath)}")
+    }
+
+    /**
+     * Checks whether given list of models contains class names outside of NLPCraft project.
+     *
+     * @param mdls Comma-separated list of fully qualified class names for data models.
+     * @return
+     */
+    private def hasExternalModels(mdls: String): Boolean =
+        U.splitTrimFilter(mdls, ",").exists(!_.startsWith("org.apache.nlpcraft."))
+
+    /**
+     * Handles tilda and checks that every component of the given class path exists relative to the current user working
+     * directory of this process.
+     *
+     * @param cp Classpath to normalize.
+     * @return
+     */
+    private def normalizeCp(cp: String): String =
+        U.splitTrimFilter(cp, CP_WIN_NIX_SEPS).map(refinePath).map(path ⇒ {
+            val normPath = refinePath(path)
+
+            if (!normPath.contains("*") && !new File(normPath).exists())
+                throw new IllegalStateException(s"Classpath not found: ${c(path)}")
+            else
+                normPath
+        })
+        .mkString(CP_SEP)
+
+    /**
+     *
+     */
+    private def cleanUpTempFiles(): Unit = {
+        val tstamp = currentTime - 1000 * 60 * 60 * 24 * 2 // 2 days ago.
+
+        for (file <- new File(SystemUtils.getUserHome, ".nlpcraft").listFiles())
+            if (file.lastModified() < tstamp) {
+                val name = file.getName
+
+                if (name.startsWith("server_log") || name.startsWith("server_log") || name.startsWith(".pid_"))
+                    file.delete()
+            }
+    }
+
+    /**
+     *
      * @param endpoint
      * @return
      */
@@ -294,15 +467,16 @@ object NCCli extends App {
 
     /**
      *
-     * @param pathOpt
+     * @param cmd Command descriptor.
+     * @param args Arguments, if any, for this command.
+     * @param repl Whether or not executing from REPL.
      */
-    private def checkFilePath(pathOpt: Option[Argument]): Unit =
-        if (pathOpt.isDefined) {
-            val file = new File(stripQuotes(pathOpt.get.value.get))
+    private [cmdline] def cmdRest(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
+        val restPath = getParam(cmd, args, "path") // REST call path (NOT a file system path).
+        val json = stripQuotes(getParam(cmd, args, "json"))
 
-            if (!file.exists() || !file.isFile)
-                throw new IllegalArgumentException(s"File not found: ${c(file.getAbsolutePath)}")
-        }
+        httpRest(cmd, restPath, json)
+    }
 
     /**
      * @param cmd  Command descriptor.
@@ -310,27 +484,15 @@ object NCCli extends App {
      * @param repl Whether or not running from REPL.
      */
     private [cmdline] def cmdStartServer(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val cfgPath = args.find(_.parameter.id == "config")
-        val igniteCfgPath = args.find(_.parameter.id == "igniteConfig")
-        val noWait = args.exists(_.parameter.id == "noWait")
-        val timeoutMins = args.find(_.parameter.id == "timeoutMins") match {
-            case Some(arg) ⇒
-                try
-                    Integer.parseInt(arg.value.get)
-                catch {
-                    case _: Exception ⇒ throw InvalidParameter(cmd, "timeoutMins")
-                }
-
-            case None ⇒ 2 // Default.
-        }
-        val jvmOpts = args.find(_.parameter.id == "jvmopts") match {
-            case Some(arg) ⇒ U.splitTrimFilter(stripQuotes(arg.value.get), " ")
+        val cfgPath = getPathParam(cmd, args, "config")
+        val igniteCfgPath = getPathParam(cmd, args, "igniteConfig")
+        val noWait = getFlagParam(cmd, args, "noWait", false)
+        val timeoutMins = getIntParam(cmd, args, "timeoutMins", 2)
+        val jvmOpts = getParamOpt(cmd, args, "jvmopts") match {
+            case Some(opts) ⇒ U.splitTrimFilter(stripQuotes(opts), " ")
             case None ⇒ Seq("-ea", "-Xms2048m", "-XX:+UseG1GC")
         }
 
-        checkFilePath(cfgPath)
-        checkFilePath(igniteCfgPath)
-
         // Ensure that there isn't another local server running.
         loadServerBeacon() match {
             case Some(b) ⇒ throw new IllegalStateException(
@@ -367,22 +529,15 @@ object NCCli extends App {
         srvArgs += JAVA_CP
         srvArgs += "org.apache.nlpcraft.NCStart"
         srvArgs += "-server"
-        srvArgs += (
-            cfgPath match {
-                case Some(path) ⇒ s"-config=${stripQuotes(path.value.get)}"
-                case None ⇒ ""
-            }
-        )
-        srvArgs += (
-            igniteCfgPath match {
-                case Some(path) ⇒ s"-igniteConfig=${stripQuotes(path.value.get)}"
-                case None ⇒ ""
-            }
-        )
+
+        if (cfgPath != null)
+            srvArgs += s"-config=$cfgPath"
+        if (igniteCfgPath != null)
+            srvArgs += s"-igniteConfig=$igniteCfgPath"
 
         val srvPb = new ProcessBuilder(srvArgs.asJava)
 
-        srvPb.directory(new File(WORK_DIR))
+        srvPb.directory(new File(USR_WORK_DIR))
         srvPb.redirectErrorStream(true)
 
         val bleachPb = new ProcessBuilder(
@@ -393,7 +548,7 @@ object NCCli extends App {
             "org.apache.nlpcraft.model.tools.cmdline.NCCliAnsiBleach"
         )
 
-        bleachPb.directory(new File(WORK_DIR))
+        bleachPb.directory(new File(USR_WORK_DIR))
         bleachPb.redirectOutput(Redirect.appendTo(output))
 
         try {
@@ -417,9 +572,7 @@ object NCCli extends App {
                 val tbl = new NCAsciiTable()
 
                 tbl += (s"${g("stop-server")}", "Stop the server.")
-                tbl += (s"${g("start-probe")}", "Start the probe.")
-                tbl += (s"${g("stop-probe")}", "Stop the probe.")
-                tbl += (s"${g("info")}", "Get server & probe information.")
+                tbl += (s"${g("info-server")}", "Get server information.")
                 tbl += (s"${g("ping-server")}", "Ping the server.")
                 tbl += (s"${g("tail-server")}", "Tail the server log.")
 
@@ -524,42 +677,6 @@ object NCCli extends App {
     }
 
     /**
-     * Checks whether given list of models contains class names outside of NLPCraft project.
-     *
-     * @param mdls Comma-separated list of fully qualified class names for data models.
-     * @return
-     */
-    private def hasExternalModels(mdls: String): Boolean =
-        U.splitTrimFilter(mdls, ",").exists(!_.startsWith("org.apache.nlpcraft."))
-
-    /**
-     * Checks that every component of the given class path exists relative to the current user working
-     * directory of this process.
-     *
-     * @param cp Classpath to check.
-     * @return
-     */
-    private def checkClasspath(cp: String): Unit =
-        for (path <- U.splitTrimFilter(cp, ";:"))
-            if (!new File(path).exists())
-                throw new IllegalStateException(s"Classpath not found: ${c(path)}")
-
-    /**
-     *
-     */
-    private def cleanUpTempFiles(): Unit = {
-        val tstamp = currentTime - 1000 * 60 * 60 * 24 * 2 // 2 days ago.
-
-        for (file <- new File(SystemUtils.getUserHome, ".nlpcraft").listFiles())
-            if (file.lastModified() < tstamp) {
-                val name = file.getName
-
-                if (name.startsWith("server_log") || name.startsWith("server_log") || name.startsWith(".pid_"))
-                    file.delete()
-            }
-    }
-
-    /**
      * @param cmd  Command descriptor.
      * @param args Arguments, if any, for this command.
      * @param repl Whether or not running from REPL.
@@ -569,22 +686,16 @@ object NCCli extends App {
         if (loadServerBeacon().isEmpty)
             throw NoLocalServer()
 
-        val cfgPath = args.find(_.parameter.id == "config")
-        val addCp = args.find(_.parameter.id == "cp") match {
-            case Some(cp) ⇒ cp.value.get
-            case None ⇒ null
-        }
-        val mdls = args.find(_.parameter.id == "models") match {
-            case Some(arg) ⇒ stripQuotes(arg.value.get)
-            case None ⇒ null
-        }
-        val jvmOpts = args.find(_.parameter.id == "jvmopts") match {
-            case Some(arg) ⇒ U.splitTrimFilter(stripQuotes(arg.value.get), " ")
+        val cfgPath = getPathParam(cmd, args, "config")
+        val addCp = getCpParam(cmd, args, "cp")
+        val mdls = getParamOrNull(cmd, args, "models")
+        val jvmOpts = getParamOpt(cmd, args, "jvmopts") match {
+            case Some(opts) ⇒ U.splitTrimFilter(stripQuotes(opts), " ")
             case None ⇒ Seq("-ea", "-Xms1024m")
         }
 
         if (mdls != null) {
-            if (hasExternalModels(mdls) && addCp == null)
+            if (hasExternalModels(mdls) && addCp != null)
                 throw new IllegalStateException(
                     s"Additional classpath is required when deploying your own models. " +
                     s"Use ${c("--cp")} parameters to provide additional classpath.")
@@ -593,31 +704,29 @@ object NCCli extends App {
         if (mdls == null && addCp != null)
             warn(s"Additional classpath (${c("--cp")}) but no models (${c("--models")}).")
 
-        if (addCp != null)
-            checkClasspath(addCp)
-
-        checkFilePath(cfgPath)
-
-        val sep = System.getProperty("path.separator")
-
         var validatorArgs = mutable.ArrayBuffer.empty[String]
 
         validatorArgs += JAVA
         validatorArgs ++= jvmOpts
 
-        if (cfgPath.isDefined)
-            validatorArgs += s"-DNLPCRAFT_PROBE_CONFIG=${cfgPath.get}"
+        if (cfgPath != null)
+            validatorArgs += s"-DNLPCRAFT_PROBE_CONFIG=$cfgPath"
 
         if (mdls != null)
             validatorArgs += s"-DNLPCRAFT_TEST_MODELS=$mdls"
 
         validatorArgs += "-cp"
-        validatorArgs += (if (addCp == null) JAVA_CP else s"$JAVA_CP$sep$addCp".replace(s"$sep$sep", sep))
+
+        if (addCp != null)
+            validatorArgs += s"$JAVA_CP$CP_SEP$addCp".replace(s"$CP_SEP$CP_SEP", CP_SEP)
+        else
+            validatorArgs += JAVA_CP
+
         validatorArgs += "org.apache.nlpcraft.model.tools.test.NCTestAutoModelValidator"
 
         val validatorPb = new ProcessBuilder(validatorArgs.asJava)
 
-        validatorPb.directory(new File(WORK_DIR))
+        validatorPb.directory(new File(USR_WORK_DIR))
         validatorPb.inheritIO()
 
         try {
@@ -641,28 +750,22 @@ object NCCli extends App {
         if (loadServerBeacon().isEmpty)
             throw NoLocalServer()
 
-        val cfgPath = args.find(_.parameter.id == "config")
-        val noWait = args.exists(_.parameter.id == "noWait")
-        val addCp = args.find(_.parameter.id == "cp") match {
-            case Some(cp) ⇒ cp.value.get
-            case None ⇒ null
+        // Ensure that there isn't another local probe running.
+        loadProbeBeacon() match {
+            case Some(b) ⇒ throw new IllegalStateException(
+                s"Existing probe (pid ${c(b.pid)}) detected. " +
+                s"Use ${c("'stop-probe'")} command to stop it, if necessary."
+            )
+            case None ⇒ ()
         }
-        val timeoutMins = args.find(_.parameter.id == "timeoutMins") match {
-            case Some(arg) ⇒
-                try
-                    Integer.parseInt(arg.value.get)
-                catch {
-                    case _: Exception ⇒ throw InvalidParameter(cmd, "timeoutMins")
-                }
 
-            case None ⇒ 1 // Default.
-        }
-        val mdls = args.find(_.parameter.id == "models") match {
-            case Some(arg) ⇒ stripQuotes(arg.value.get)
-            case None ⇒ null
-        }
-        val jvmOpts = args.find(_.parameter.id == "jvmopts") match {
-            case Some(arg) ⇒ U.splitTrimFilter(stripQuotes(arg.value.get), " ")
+        val cfgPath = getPathParam(cmd, args, "config")
+        val noWait = getFlagParam(cmd, args, "noWait", false)
+        val addCp = getCpParam(cmd, args, "cp")
+        val timeoutMins = getIntParam(cmd, args, "timeoutMins", 1)
+        val mdls = getParamOrNull(cmd, args, "models")
+        val jvmOpts = getParamOpt(cmd, args, "jvmopts") match {
+            case Some(opts) ⇒ U.splitTrimFilter(stripQuotes(opts), " ")
             case None ⇒ Seq("-ea", "-Xms1024m")
         }
 
@@ -676,20 +779,6 @@ object NCCli extends App {
         if (mdls == null && addCp != null)
             warn(s"Additional classpath (${c("--cp")}) but no models (${c("--models")}).")
 
-        if (addCp != null)
-            checkClasspath(addCp)
-
-        checkFilePath(cfgPath)
-
-        // Ensure that there isn't another local probe running.
-        loadProbeBeacon() match {
-            case Some(b) ⇒ throw new IllegalStateException(
-                s"Existing probe (pid ${c(b.pid)}) detected. " +
-                s"Use ${c("'stop-probe'")} command to stop it, if necessary."
-            )
-            case None ⇒ ()
-        }
-
         val logTstamp = currentTime
 
         // Server log redirect.
@@ -698,8 +787,6 @@ object NCCli extends App {
         // Store in REPL state right away.
         state.probeLog = Some(output)
 
-        val sep = System.getProperty("path.separator")
-
         var prbArgs = mutable.ArrayBuffer.empty[String]
 
         prbArgs += JAVA
@@ -710,22 +797,19 @@ object NCCli extends App {
             prbArgs += "-Dconfig.override_with_env_vars=true"
 
         prbArgs += "-cp"
-        prbArgs += (if (addCp == null) JAVA_CP else s"$JAVA_CP$sep$addCp".replace(s"$sep$sep", sep))
+        prbArgs += (if (addCp == null) JAVA_CP else s"$JAVA_CP$CP_SEP$addCp".replace(s"$CP_SEP$CP_SEP", CP_SEP))
         prbArgs += "org.apache.nlpcraft.NCStart"
         prbArgs += "-probe"
-        prbArgs += (
-            cfgPath match {
-                case Some(path) ⇒ s"-config=${stripQuotes(path.value.get)}"
-                case None ⇒ ""
-            }
-        )
+
+        if (cfgPath != null)
+            prbArgs += s"-config=$cfgPath"
 
         val prbPb = new ProcessBuilder(prbArgs.asJava)
 
         if (mdls != null)
             prbPb.environment().put("CONFIG_FORCE_nlpcraft_probe_models", mdls)
 
-        prbPb.directory(new File(WORK_DIR))
+        prbPb.directory(new File(USR_WORK_DIR))
         prbPb.redirectErrorStream(true)
 
         val bleachPb = new ProcessBuilder(
@@ -736,7 +820,7 @@ object NCCli extends App {
             "org.apache.nlpcraft.model.tools.cmdline.NCCliAnsiBleach"
         )
 
-        bleachPb.directory(new File(WORK_DIR))
+        bleachPb.directory(new File(USR_WORK_DIR))
         bleachPb.redirectOutput(Redirect.appendTo(output))
 
         try {
@@ -892,16 +976,7 @@ object NCCli extends App {
      * @param repl Whether or not executing from REPL.
      */
     private [cmdline] def cmdTailServer(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val lines = args.find(_.parameter.id == "lines") match {
-            case Some(arg) ⇒
-                try
-                    Integer.parseInt(arg.value.get)
-                catch {
-                    case _: Exception ⇒ throw InvalidParameter(cmd, "lines")
-                }
-
-            case None ⇒ 20 // Default.
-        }
+        val lines = getIntParam(cmd, args, "lines", 20)
 
         if (lines <= 0)
             throw InvalidParameter(cmd, "lines")
@@ -918,16 +993,7 @@ object NCCli extends App {
      * @param repl Whether or not executing from REPL.
      */
     private [cmdline] def cmdTailProbe(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val lines = args.find(_.parameter.id == "lines") match {
-            case Some(arg) ⇒
-                try
-                    Integer.parseInt(arg.value.get)
-                catch {
-                    case _: Exception ⇒ throw InvalidParameter(cmd, "lines")
-                }
-
-            case None ⇒ 20 // Default.
-        }
+        val lines = getIntParam(cmd, args, "lines", 20)
 
         if (lines <= 0)
             throw InvalidParameter(cmd, "lines")
@@ -944,21 +1010,12 @@ object NCCli extends App {
      * @param repl Whether or not executing from REPL.
      */
     private [cmdline] def cmdPingServer(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val endpoint = getRestEndpointFromBeacon
-
-        val num = args.find(_.parameter.id == "number") match {
-            case Some(arg) ⇒
-                try
-                    Integer.parseInt(arg.value.get)
-                catch {
-                    case _: Exception ⇒ throw InvalidParameter(cmd, "number")
-                }
-
-            case None ⇒ 1 // Default.
-        }
+        val num = getIntParam(cmd, args, "number", 1)
 
         var i = 0
 
+        val endpoint = getRestEndpointFromBeacon
+
         while (i < num) {
             log(s"(${i + 1} of $num) pinging server at ${b(endpoint)} ")
 
@@ -999,7 +1056,7 @@ object NCCli extends App {
             i += 1
 
             if (i < num)
-            // Pause between pings.
+                // Pause between pings.
                 Thread.sleep(500.ms)
         }
     }
@@ -1603,8 +1660,8 @@ object NCCli extends App {
     private [cmdline] def cmdSignIn(cmd: Command, args: Seq[Argument], repl: Boolean): Unit =
         state.accessToken match {
             case None ⇒
-                val email = args.find(_.parameter.id == "email").flatMap(_.value).getOrElse(DFLT_USER_EMAIL)
-                val passwd = args.find(_.parameter.id == "passwd").flatMap(_.value).getOrElse(DFLT_USER_PASSWD)
+                val email = getParam(cmd, args, "email", DFLT_USER_EMAIL)
+                val passwd = getParam(cmd, args, "passwd", DFLT_USER_PASSWD)
 
                 httpRest(
                     cmd,
@@ -1691,8 +1748,8 @@ object NCCli extends App {
     private [cmdline] def cmdSugSyn(cmd: Command, args: Seq[Argument], repl: Boolean): Unit =
         state.accessToken match {
             case Some(acsTok) ⇒
-                val mdlId = args.find(_.parameter.id == "mdlId").flatMap(_.value).getOrElse(throw MissingParameter(cmd, "mdlId"))
-                val minScore = Try(args.find(_.parameter.id == "minScore").flatMap(_.value).getOrElse("0.5").toFloat).getOrElse(throw InvalidParameter(cmd, "minScore"))
+                val mdlId = getParam(cmd, args, "mdlId")
+                val minScore = getDoubleParam(cmd, args, "minScore", 0.5)
 
                 httpRest(
                     cmd,
@@ -1718,10 +1775,10 @@ object NCCli extends App {
     private [cmdline] def cmdAsk(cmd: Command, args: Seq[Argument], repl: Boolean): Unit =
         state.accessToken match {
             case Some(acsTok) ⇒
-                val mdlId = args.find(_.parameter.id == "mdlId").flatMap(_.value).getOrElse(throw MissingParameter(cmd, "mdlId"))
-                val txt = args.find(_.parameter.id == "txt").flatMap(_.value).getOrElse(throw MissingParameter(cmd, "txt"))
-                val data = args.find(_.parameter.id == "data").flatMap(_.value).orNull
-                val enableLog = args.find(_.parameter.id == "enableLog").flatMap(_.value).getOrElse(false)
+                val mdlId = getParam(cmd, args, "mdlId")
+                val txt = getParam(cmd, args, "txt")
+                val data = getParamOrNull(cmd, args, "data")
+                val enableLog = getFlagParam(cmd, args, "enableLog", false)
 
                 httpRest(
                     cmd,
@@ -1792,46 +1849,6 @@ object NCCli extends App {
     }
 
     /**
-     *
-     * @param cmd Command descriptor.
-     * @param args Arguments, if any, for this command.
-     * @param repl Whether or not executing from REPL.
-     */
-    private [cmdline] def cmdRest(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val path = args.find(_.parameter.id == "path").getOrElse(throw MissingParameter(cmd, "path")).value.get
-        val json = stripQuotes(args.find(_.parameter.id == "json").getOrElse(throw MissingParameter(cmd, "json")).value.get)
-
-        httpRest(cmd, path, json)
-    }
-
-    /**
-      * @param cmd
-      * @param args
-      * @param id
-      * @param dflt
-      */
-    @throws[MissingParameter]
-    private def get(cmd: Command, args: Seq[Argument], id: String, dflt: String = null): String =
-        args.find(_.parameter.id == id).flatMap(_.value) match {
-            case Some(v) ⇒ v
-            case None ⇒
-                if (dflt == null)
-                    throw MissingParameter(cmd, id)
-
-                dflt
-        }
-
-    /**
-      *
-      * @param path
-      */
-    private def refinePath(path: String): String = {
-        require(path != null)
-
-        if (path.nonEmpty && path.head == '~') new File(SystemUtils.getUserHome, path.tail).getAbsolutePath else path
-    }
-
-    /**
       *
       * @param cmd
       * @param name
@@ -1980,9 +1997,9 @@ object NCCli extends App {
       * @param repl Whether or not executing from REPL.
       */
     private [cmdline] def cmdGenModel(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val filePath = refinePath(get(cmd, args, "filePath"))
-        val overrideFlag = get(cmd, args,"override", "false").toLowerCase
-        val modelId = get(cmd, args,"modelId")
+        val filePath = refinePath(getParam(cmd, args, "filePath"))
+        val overrideFlag = getParam(cmd, args,"override", "false").toLowerCase
+        val mdlId = getParam(cmd, args,"mdlId")
 
         checkSupported(cmd,"overrideFlag", overrideFlag, "true", "false")
 
@@ -2017,7 +2034,7 @@ object NCCli extends App {
             s"src/main/resources/template_model.$fileExt",
             out.getName,
             Some(extractHdr),
-            "templateModelId" → modelId
+            "templateModelId" → mdlId
         )
 
         logln(s"Model file stub created: ${c(out.getCanonicalPath)}")
@@ -2030,13 +2047,13 @@ object NCCli extends App {
       * @param repl Whether or not executing from REPL.
       */
     private [cmdline] def cmdGenProject(cmd: Command, args: Seq[Argument], repl: Boolean): Unit = {
-        val outputDir = refinePath(get(cmd, args, "outputDir", "."))
-        val baseName = get(cmd, args,"baseName")
-        val lang = get(cmd, args,"lang", "java").toLowerCase
-        val buildTool = get(cmd, args,"buildTool", "mvn").toLowerCase
-        val pkgName = get(cmd, args,"packageName", "org.apache.nlpcraft.demo").toLowerCase
-        val fileType = get(cmd, args,"modelType", "yaml").toLowerCase
-        val overrideFlag = get(cmd, args,"override", "false").toLowerCase
+        val outputDir = refinePath(getParam(cmd, args, "outputDir", "."))
+        val baseName = getParam(cmd, args,"baseName")
+        val lang = getParam(cmd, args,"lang", "java").toLowerCase
+        val buildTool = getParam(cmd, args,"buildTool", "mvn").toLowerCase
+        val pkgName = getParam(cmd, args,"packageName", "org.apache.nlpcraft.demo").toLowerCase
+        val fileType = getParam(cmd, args,"modelType", "yaml").toLowerCase
+        val overrideFlag = getParam(cmd, args,"override", "false").toLowerCase
         val dst = new File(outputDir, baseName)
         val pkgDir = pkgName.replaceAll("\\.", "/")
         val clsName = s"${baseName.head.toUpper}${baseName.tail}"
@@ -2537,7 +2554,7 @@ object NCCli extends App {
                 val prompt1 = if (state.isServerOnline) gb(k(s" server: ${BO}ON$RST$GB ")) else rb(w(s" server: ${BO}OFF$RST$RB "))
                 val prompt2 = if (state.isProbeOnline) gb(k(s" probe: ${BO}ON$RST$GB ")) else rb(w(s" probe: ${BO}OFF$RST$RB "))
                 val prompt3 = wb(k(s" acsTok: $acsTokStr")) // Access token, if any.
-                val prompt4 = kb(g(s" $WORK_DIR ")) // Current working directory.
+                val prompt4 = kb(g(s" $USR_WORK_DIR ")) // Current working directory.
 
                 if (!wasLastLineEmpty)
                     reader.printAbove("\n" + prompt1 + ":" + prompt2 + ":" + prompt3 + ":" + prompt4)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
index 9ccdce8..2d2b216 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
@@ -124,8 +124,8 @@ private [cmdline] object NCCliCommands {
                     value = Some("'json'"),
                     desc =
                         s"REST call parameters as JSON object. Since standard JSON only supports double " +
-                        s"quotes the entire JSON string should be enclosed in single quotes. You can " +
-                        s"find full OpenAPI specification for NLPCraft REST API at " +
+                        s"quotes the entire JSON string should be enclosed in single quotes. Note that on Windows you " +
+                        s"need to escape double quotes. You can find full OpenAPI specification for NLPCraft REST API at " +
                         s"https://nlpcraft.apache.org/using-rest.html"
                 )
             ),
@@ -141,8 +141,8 @@ private [cmdline] object NCCliCommands {
                 Example(
                     usage = Seq(
                         s"> nlpcraft.cmd rest ",
-                        "  -p=signin",
-                        "  -j='{\\\"email\\\": \\\"admin@admin.com\\\", \\\"passwd\\\": \\\"admin\\\"}'"
+                        "  --path=signin",
+                        "  --json='{\\\"email\\\": \\\"admin@admin.com\\\", \\\"passwd\\\": \\\"admin\\\"}'"
                     ),
                     desc =
                         s"${bo("Windows:")} issues ${y("'signin'")} REST call with given JSON payload. " +
@@ -156,8 +156,8 @@ private [cmdline] object NCCliCommands {
             synopsis = s"Wrapper for ${c("'/signin'")} REST call.",
             desc = Some(
                 s"If no arguments provided, it signs in with the " +
-                    s"default 'admin@admin.com' user account. NOTE: please make sure to remove this account when " +
-                    s"running in production."
+                s"default 'admin@admin.com' user account. NOTE: please make sure to remove this account when " +
+                s"running in production."
             ),
             body = NCCli.cmdSignIn,
             params = Seq(
@@ -167,12 +167,12 @@ private [cmdline] object NCCliCommands {
                     value = Some("email"),
                     optional = true,
                     desc =
-                        s"Email of the user. If not provided, 'admin@admin.com' will be used."
+                        s"Email of the user. If not provided, default 'admin@admin.com' email will be used."
                 ),
                 Parameter(
                     id = "passwd",
                     names = Seq("--passwd", "-p"),
-                    value = Some("****"),
+                    value = Some("password"),
                     optional = true,
                     desc =
                         s"User password to sign in. If not provided, the default password will be used."
@@ -210,9 +210,9 @@ private [cmdline] object NCCliCommands {
             synopsis = s"REST call in a convenient way for REPL mode.",
             desc = Some(
                 s"When using this command you supply all call parameters separately through their own parameters named " +
-                    s"after their corresponding parameters in REST specification. " +
-                    s"In REPL mode, hit ${rv(" Tab ")} to see auto-suggestion and " +
-                    s"auto-completion candidates for commonly used paths and call parameters."
+                s"after their corresponding parameters in REST specification. " +
+                s"In REPL mode, hit ${rv(" Tab ")} to see auto-suggestion and " +
+                s"auto-completion candidates for commonly used paths and call parameters."
             ),
             body = NCCli.cmdCall,
             params = Seq(
@@ -236,7 +236,7 @@ private [cmdline] object NCCliCommands {
                         s"${y("'xxx'")} name corresponds to the REST call parameter that can be found at https://nlpcraft.apache.org/using-rest.html " +
                         s"The value of this parameter should be a valid JSON value using valid JSON syntax. Note that strings " +
                         s"don't have to be in double quotes. JSON objects and arrays should be specified as a JSON string in single quotes. You can have " +
-                        s"as many ${y("'--xxx=value'")} parameters as requires by the ${y("'--path'")} parameter. " +
+                        s"as many ${y("'--xxx=value'")} parameters as requires by the ${y("'--path'")} parameter. Note that on Windows you need to escape double quotes. " +
                         s"In REPL mode, hit ${rv(" Tab ")} to see auto-suggestion for possible parameters and their values."
                 )
             ),
@@ -293,7 +293,7 @@ private [cmdline] object NCCliCommands {
             params = Seq(
                 Parameter(
                     id = "mdlId",
-                    names = Seq("--mdlId"),
+                    names = Seq("--mdlId", "-m"),
                     value = Some("model.id"),
                     desc =
                         s"ID of the data model to send the request to. " +
@@ -301,24 +301,23 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "txt",
-                    names = Seq("--txt"),
+                    names = Seq("--txt", "-t"),
                     value = Some("txt"),
                     desc =
                         s"Text of the question."
                 ),
                 Parameter(
                     id = "data",
-                    names = Seq("--data"),
+                    names = Seq("--data", "-d"),
                     value = Some("'{}'"),
                     optional = true,
                     desc = s"Additional JSON data with maximum JSON length of 512000 bytes. Default is ${c("'null'")}."
                 ),
                 Parameter(
                     id = "enableLog",
-                    names = Seq("--enableLog"),
-                    value = Some("true|false"),
+                    names = Seq("--enableLog", "-l"),
                     optional = true,
-                    desc = s"Flag to enable detailed processing log to be returned with the result. Default is ${c("'false'")}."
+                    desc = s"Enable detailed processing log to be returned with the result."
                 )
             ),
             examples = Seq(
@@ -389,21 +388,21 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "modelId",
-                    names = Seq("--model-id", "-x"),
+                    names = Seq("--mdlId", "-m"),
                     value = Some("id"),
                     optional = true,
                     desc = s"Generated model ID. By default, the model ID is ${c("'sql.model.id'")}."
                 ),
                 Parameter(
                     id = "modelVer",
-                    names = Seq("--model-ver", "-v"),
+                    names = Seq("--mdlVer", "-v"),
                     value = Some("version"),
                     optional = true,
                     desc = s"Generated model version. By default, the model version is ${c("'1.0.0-timestamp'")}."
                 ),
                 Parameter(
                     id = "modelName",
-                    names = Seq("--model-name", "-n"),
+                    names = Seq("--mdlName", "-n"),
                     value = Some("name"),
                     optional = true,
                     desc = s"Generated model name. By default, the model name is ${c("'SQL-based-model'")}."
@@ -476,7 +475,7 @@ private [cmdline] object NCCliCommands {
                     optional = true,
                     desc =
                         s"Gets extended help and usage information for the ${c("'gen-sql'")} command. " +
-                        s"Includes information on how to run this tool standalone."
+                        s"Includes information on how to run this tool standalone in a separate process."
                 )
             ),
             examples = Seq(
@@ -490,16 +489,16 @@ private [cmdline] object NCCliCommands {
                 Example(
                     usage = Seq(
                         s"$PROMPT $SCRIPT_NAME gen-sql",
-                        "  --url=jdbc:postgresql://localhost:5432/mydb",
-                        "  --driver=org.postgresql.Driver",
+                          "  --url=jdbc:postgresql://localhost:5432/mydb",
+                          "  --driver=org.postgresql.Driver",
                         """  --prefix="tbl_, col_"""",
                         """  --suffix="_tmp, _old, _unused"""",
-                        "  --schema=public",
+                          "  --schema=public",
                         """  --exclude="#_.+"""",
-                        "  --out=model.json"
+                          "  --out=model.json"
                     ),
                     desc =
-                        s"Generates model stub from given SQL database connection."
+                        s"Generates ${c("'model.json'")} model stub from given SQL database connection."
                 )
             )
         ),
@@ -512,13 +511,14 @@ private [cmdline] object NCCliCommands {
                 s"it requires user to be signed in. REPL session keeps the currently active access " +
                 s"token after user signed in. For command line mode, use ${c("'rest'")} command with " +
                 s"corresponding parameters. Note also that it requires a local probe running that hosts " +
-                s"the specified model. Find more information about this tool at https://nlpcraft.apache.org/tools/syn_tool.html"
+                s"the specified model as well as running ${c("'ctxword'")} server. Find more information about " +
+                s"this tool at https://nlpcraft.apache.org/tools/syn_tool.html"
             ),
             body = NCCli.cmdSugSyn,
             params = Seq(
                 Parameter(
                     id = "mdlId",
-                    names = Seq("--mdlId"),
+                    names = Seq("--mdlId", "-m"),
                     value = Some("model.id"),
                     desc =
                         s"ID of the model to run synonym suggestion on. " +
@@ -527,7 +527,7 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "minScore",
-                    names = Seq("--minScore"),
+                    names = Seq("--minScore", "-s"),
                     value = Some("0.5"),
                     optional = true,
                     desc = s"Minimal score to include into the result (from 0 to 1). Default is ${c("0.5")}."
@@ -536,7 +536,7 @@ private [cmdline] object NCCliCommands {
             examples = Seq(
                 Example(
                     usage = Seq(
-                        s"""> sugsyn --mdlId=my.model.id"""
+                        s"""> sugsyn -m=my.model.id"""
                     ),
                     desc =
                         s"Issues ${y("'model/sugsyn'")} REST call with default min score and given model ID."
@@ -555,7 +555,7 @@ private [cmdline] object NCCliCommands {
                 Parameter(
                     id = "lines",
                     names = Seq("--lines", "-l"),
-                    value = Some("num"),
+                    value = Some("20"),
                     desc =
                         s"Number of the server log lines from the end to display. Default is 20."
                 )
@@ -579,7 +579,7 @@ private [cmdline] object NCCliCommands {
                 Parameter(
                     id = "lines",
                     names = Seq("--lines", "-l"),
-                    value = Some("num"),
+                    value = Some("20"),
                     desc =
                         s"Number of the probe log lines from the end to display. Default is 20."
                 )
@@ -597,24 +597,25 @@ private [cmdline] object NCCliCommands {
             synopsis = s"Starts local server.",
             desc = Some(
                 s"Server is started in the external JVM process with both stdout and stderr piped out into log file. " +
-                s"Command will block until the server is started unless ${y("'--no-wait'")} parameter is used or timeout is expired."
+                s"Command will block until the server is started unless ${y("'--noWait'")} parameter is used or timeout is expired."
             ),
             body = NCCli.cmdStartServer,
             params = Seq(
                 Parameter(
                     id = "config",
-                    names = Seq("--config", "-c"),
+                    names = Seq("--cfg", "-c"),
                     value = Some("path"),
                     optional = true,
                     desc =
                         s"Configuration file path. Server will automatically look for ${y("'nlpcraft.conf'")} " +
                         s"configuration file in the same directory as NLPCraft JAR file. If the configuration file has " +
                         s"different name or in different location use this parameter to provide an alternative path. " +
-                        s"Note that the server and the probe can use the same file for their configuration."
+                        s"Note that the server and the probe can use the same file for their configuration. " +
+                        s"Note also that you can use ${c("'~'")} at the beginning of the path to specify user home directory."
                 ),
                 Parameter(
                     id = "igniteConfig",
-                    names = Seq("--ignite-config", "-i"),
+                    names = Seq("--igniteCfg", "-i"),
                     value = Some("path"),
                     optional = true,
                     desc =
@@ -622,11 +623,12 @@ private [cmdline] object NCCliCommands {
                         s"computing plane and a default distributed storage. Server will automatically look for " +
                         s"${y("'ignite.xml'")} configuration file in the same directory as NLPCraft JAR file. If the " +
                         s"configuration file has different name or in different location use this parameter to " +
-                        s"provide an alternative path."
+                        s"provide an alternative path. " +
+                        s"Note also that you can use ${c("'~'")} at the beginning of the path to specify user home directory."
                 ),
                 Parameter(
                     id = "jvmopts",
-                    names = Seq("--jvm-opts", "-j"),
+                    names = Seq("--jvmOpts", "-j"),
                     value = Some("<jvm flags>"),
                     optional = true,
                     desc =
@@ -635,14 +637,14 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "noWait",
-                    names = Seq("--no-wait"),
+                    names = Seq("--noWait"),
                     optional = true,
                     desc =
                         s"Instructs command not to wait for the server startup and return immediately."
                 ),
                 Parameter(
                     id = "timeoutMins",
-                    names = Seq("--timeout-mins", "-t"),
+                    names = Seq("--timeoutMins", "-t"),
                     optional = true,
                     value = Some("3"),
                     desc =
@@ -655,7 +657,7 @@ private [cmdline] object NCCliCommands {
                     desc = "Starts local server with default configuration."
                 ),
                 Example(
-                    usage = Seq(s"$PROMPT $SCRIPT_NAME start-server -c=/opt/nlpcraft/nlpcraft.conf -t=5"),
+                    usage = Seq(s"$PROMPT $SCRIPT_NAME start-server -c=~/myapp/nlpcraft.conf -t=5"),
                     desc = "Starts local server with alternative configuration file and timeout of 5 mins."
                 )
             )
@@ -666,20 +668,21 @@ private [cmdline] object NCCliCommands {
             synopsis = s"Starts local probe.",
             desc = Some(
                 s"Probe is started in the external JVM process with both stdout and stderr piped out into log file. " +
-                s"Command will block until the probe is started unless ${y("'--no-wait'")} parameter is used or timeout is expired."
+                s"Command will block until the probe is started unless ${y("'--noWait'")} parameter is used or timeout is expired."
             ),
             body = NCCli.cmdStartProbe,
             params = Seq(
                 Parameter(
                     id = "config",
-                    names = Seq("--config", "-c"),
+                    names = Seq("--cfg", "-c"),
                     value = Some("path"),
                     optional = true,
                     desc =
                         s"Configuration file path. Probe will automatically look for ${y("'nlpcraft.conf'")} " +
                         s"configuration file in the same directory as NLPCraft JAR file. If the configuration file has " +
                         s"different name or in different location use this parameter to provide an alternative path. " +
-                        s"Note that the server and the probe can use the same file for their configuration."
+                        s"Note that the server and the probe can use the same file for their configuration. " +
+                        s"Note also that you can use ${c("'~'")} at the beginning of the path to specify user home directory."
                 ),
                 Parameter(
                     id = "cp",
@@ -690,23 +693,24 @@ private [cmdline] object NCCliCommands {
                         s"Additional JVM classpath that will be appended to the default NLPCraft JVM classpath. " +
                         s"Although this configuration property is optional, when deploying your own models you must " +
                         s"provide this additional classpath for the models and their dependencies this probe will be hosting. " +
-                        s"NOTE: this is only optional if you are running example models shipped with NLPCraft."
+                        s"Note that this is only optional if you are running example models shipped with NLPCraft. " +
+                        s"Note also that you can use ${c("'~'")} at the beginning of the classpath component to specify user home directory."
                 ),
                 Parameter(
                     id = "models",
-                    names = Seq("--models", "-m"),
+                    names = Seq("--mdls", "-m"),
                     value = Some("<model list>"),
                     optional = true,
                     desc =
                         s"Comma separated list of fully qualified class names for models to deploy. This will override " +
                         s"${y("'nlpcraft.probe.models'")} configuration property from either default configuration file " +
-                        s"or the one provided by ${y("--config")} parameter. NOTE: if you provide the list of your " +
+                        s"or the one provided by ${y("--cfg")} parameter. Note that if you provide the list of your " +
                         s"own models here or in configuration file - you must also provide the additional classpath " +
                         s"for them via ${y("--cp")} parameter."
                 ),
                 Parameter(
                     id = "jvmopts",
-                    names = Seq("--jvm-opts", "-j"),
+                    names = Seq("--jvmOpts", "-j"),
                     value = Some("<jvm flags>"),
                     optional = true,
                     desc =
@@ -715,14 +719,14 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "noWait",
-                    names = Seq("--no-wait"),
+                    names = Seq("--noWait"),
                     optional = true,
                     desc =
                         s"Instructs command not to wait for the probe startup and return immediately."
                 ),
                 Parameter(
                     id = "timeoutMins",
-                    names = Seq("--timeout-mins", "-t"),
+                    names = Seq("--timeoutMins", "-t"),
                     optional = true,
                     value = Some("3"),
                     desc =
@@ -737,11 +741,11 @@ private [cmdline] object NCCliCommands {
                 Example(
                     usage = Seq(
                         s"$PROMPT $SCRIPT_NAME start-probe ",
-                        "  --config=/opt/nlpcraft.conf ",
-                        "  --models=my.package.Model ",
-                        "  --cp=/opt/target/classes ",
-                        "  --jmv-opts=\"-ea -Xms2048m\" ",
-                        "  --timeout-mins=5"
+                        "  --cfg=~/myapp/nlpcraft.conf ",
+                        "  --mdls=my.package.Model ",
+                        "  --cp=~/myapp/target/classes ",
+                        "  --jmvOpts=\"-ea -Xms2048m\" ",
+                        "  --timeoutMins=5"
                     ),
                     desc =
                         s"Starts local probe for ${y("'my.package.Model'")} model with alternative configuration " +
@@ -764,13 +768,14 @@ private [cmdline] object NCCliCommands {
             params = Seq(
                 Parameter(
                     id = "config",
-                    names = Seq("--config", "-c"),
+                    names = Seq("--cfg", "-c"),
                     value = Some("path"),
                     optional = true,
                     desc =
                         s"Configuration file path. By default, the embedded probe will automatically look for ${y("'nlpcraft.conf'")} " +
                         s"configuration file in the same directory as NLPCraft JAR file. If the configuration file has " +
-                        s"different name or in different location use this parameter to provide an alternative path."
+                        s"different name or in different location use this parameter to provide an alternative path. " +
+                        s"Note also that you can use ${c("'~'")} at the beginning of the path to specify user home directory."
                 ),
                 Parameter(
                     id = "cp",
@@ -781,11 +786,12 @@ private [cmdline] object NCCliCommands {
                         s"Additional JVM classpath that will be appended to the default NLPCraft JVM classpath. " +
                         s"Although this configuration property is optional, when testing your own models you must " +
                         s"provide this additional classpath for the models and their dependencies. " +
-                        s"NOTE: this is only optional if you are testing example models shipped with NLPCraft."
+                        s"Note that this is only optional if you are testing example models shipped with NLPCraft. " +
+                        s"Note also that you can use ${c("'~'")} at the beginning of the classpath component to specify user home directory."
                 ),
                 Parameter(
                     id = "models",
-                    names = Seq("--models", "-m"),
+                    names = Seq("--mdls", "-m"),
                     value = Some("<model list>"),
                     optional = true,
                     desc =
@@ -795,7 +801,7 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "jvmopts",
-                    names = Seq("--jvm-opts", "-j"),
+                    names = Seq("--jvmOpts", "-j"),
                     value = Some("<jvm flags>"),
                     optional = true,
                     desc =
@@ -807,9 +813,9 @@ private [cmdline] object NCCliCommands {
                 Example(
                     usage = Seq(
                         s"$PROMPT $SCRIPT_NAME test-model ",
-                        "  --models=my.package.Model ",
-                        "  --cp=/opt/target/classes ",
-                        "  --jmv-opts=\"-ea -Xms2048m\""
+                        "  --mdls=my.package.Model ",
+                        "  --cp=~/myapp/target/classes ",
+                        "  --jmvOpts=\"-ea -Xms2048m\""
                     ),
                     desc =
                         s"Runs model auto-validator for ${y("'my.package.Model'")} model."
@@ -868,7 +874,7 @@ private [cmdline] object NCCliCommands {
                     usage = Seq(s"$PROMPT $SCRIPT_NAME version -s no-logo"),
                     desc =
                         s"Displays just the version information without any additional logo output. " +
-                            s"This command makes sense only in command lime mode (NOT in REPL mode)."
+                        s"This command makes sense only in command lime mode (NOT in REPL mode)."
                 )
             )
         ),
@@ -899,7 +905,7 @@ private [cmdline] object NCCliCommands {
                 Parameter(
                     id = "number",
                     names = Seq("--number", "-n"),
-                    value = Some("num"),
+                    value = Some("1"),
                     optional = true,
                     desc =
                         "Number of pings to perform. Must be a number > 0. Default is 1."
@@ -993,14 +999,14 @@ private [cmdline] object NCCliCommands {
             params = Seq(
                 Parameter(
                     id = "semver",
-                    names = Seq("--sem-ver", "-s"),
+                    names = Seq("--semVer", "-s"),
                     value = None,
                     optional = true,
                     desc = s"Display only the semantic version value, e.g. ${VER.version}."
                 ),
                 Parameter(
                     id = "reldate",
-                    names = Seq("--rel-date", "-d"),
+                    names = Seq("--relDate", "-d"),
                     value = None,
                     optional = true,
                     desc = s"Display only the release date, e.g. ${VER.date}."
@@ -1022,7 +1028,9 @@ private [cmdline] object NCCliCommands {
                     names = Seq("--outputDir", "-d"),
                     value = Some("path"),
                     optional = true,
-                    desc = s"Output directory. Default value is the current working directory."
+                    desc =
+                        s"Output directory. Default value is the current working directory. " +
+                        s"Note that you can use ${c("'~'")} at the beginning of the path to specify user home directory."
                 ),
                 Parameter(
                     id = "baseName",
@@ -1052,14 +1060,14 @@ private [cmdline] object NCCliCommands {
                 ),
                 Parameter(
                     id = "packageName",
-                    names = Seq("--packageName", "-p"),
+                    names = Seq("--pckgName", "-p"),
                     value = Some("name"),
                     optional = true,
                     desc = s"JVM package name to use in generated source code. Default value is ${y("'org.apache.nlpcraft.demo'")}."
                 ),
                 Parameter(
                     id = "modelType",
-                    names = Seq("--modelType", "-m"),
+                    names = Seq("--mdlType", "-m"),
                     value = Some("type"),
                     optional = true,
                     desc = s"Type of generated model file. Supported value are ${y("'yaml'")} or ${y("'json'")}. Default value is ${y("'yaml'")}."
@@ -1067,9 +1075,8 @@ private [cmdline] object NCCliCommands {
                 Parameter(
                     id = "override",
                     names = Seq("--override", "-o"),
-                    value = Some("true|false"),
                     optional = true,
-                    desc = s"Whether or not to override existing output directory. Default value is ${y("'false'")}."
+                    desc = s"Overrides existing output directory, if any."
                 )
             ),
             examples = Seq(
@@ -1078,7 +1085,7 @@ private [cmdline] object NCCliCommands {
                     desc = s"Generates Scala SBT project."
                 ),
                 Example(
-                    usage = Seq("> gen-project -n=MyProject -l=kotlin -p=com.mycompany.nlp -o=true"),
+                    usage = Seq("> gen-project -n=MyProject -l=kotlin -p=com.mycompany.nlp -o"),
                     desc = s"Generates Kotlin Maven project."
                 )
             )
@@ -1099,29 +1106,29 @@ private [cmdline] object NCCliCommands {
                     desc =
                         s"File path for the model stub. File path can either be an absolute path, relative path or " +
                         s"just a file name in which case the current folder will be used. File must have one of the " +
-                        s"following extensions: ${y("'json'")}, ${y("'js'")}, ${y("'yaml'")}, or ${y("'yml'")}."
+                        s"following extensions: ${y("'json'")}, ${y("'js'")}, ${y("'yaml'")}, or ${y("'yml'")}. " +
+                        s"Note that you can use ${c("'~'")} at the beginning of the path to specify user home directory."
                 ),
                 Parameter(
                     id = "modelId",
-                    names = Seq("--modelId", "-n"),
+                    names = Seq("--mdlId", "-m"),
                     value = Some("id"),
                     desc = "Model ID."
                 ),
                 Parameter(
                     id = "override",
                     names = Seq("--override", "-o"),
-                    value = Some("true|false"),
                     optional = true,
-                    desc = s"Override output directory flag. Supported: ${y("'true'")}, ${y("'false'")}. Default value is ${y("'false'")}"
+                    desc = s"Overrides output file, if any."
                 )
             ),
             examples = Seq(
                 Example(
-                    usage = Seq("> gen-model -f=myModel.json -n=my.model.id"),
+                    usage = Seq("> gen-model --filePath=~/myapp/myModel.json --mdlId=my.model.id"),
                     desc = s"Generates JSON model file stub in the current folder."
                 ),
                 Example(
-                    usage = Seq("> gen-model -f=c:/tmp/myModel.yaml -n=my.model.id --override=true"),
+                    usage = Seq("> gen-model -f=c:/tmp/myModel.yaml -m=my.model.id -o"),
                     desc = s"Generates YAML model file stub in ${y("'c:/temp'")} folder overriding existing file, if any."
                 )
             )