This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-122
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-122 by this push:
new abfc4ad Initial fix for NLPCRAFT-122.
abfc4ad is described below
commit abfc4ad80166a3618d2341a1a199f6d4cae4416c
Author: Aaron Radzinski <[email protected]>
AuthorDate: Mon Sep 14 00:41:18 2020 -0700
Initial fix for NLPCRAFT-122.
---
.../main/scala/org/apache/nlpcraft/NCStart.scala | 23 +++++++++----------
.../org/apache/nlpcraft/common/util/NCUtils.scala | 14 ++++++++++++
.../org/apache/nlpcraft/probe/NCProbeBoot.scala | 26 +++++++++-------------
.../org/apache/nlpcraft/server/NCServer.scala | 24 +++++++++-----------
4 files changed, 44 insertions(+), 43 deletions(-)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCStart.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCStart.scala
index bd57713..4e4edbf 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/NCStart.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/NCStart.scala
@@ -21,6 +21,8 @@ import com.typesafe.scalalogging.LazyLogging
import org.apache.nlpcraft.common.version.NCVersion
import org.apache.nlpcraft.probe.NCProbe
import org.apache.nlpcraft.server.NCServer
+import org.apache.nlpcraft.common._
+import org.apache.nlpcraft.common.ansi.NCAnsiColor._
/**
* Server or probe command line starter.
@@ -47,25 +49,20 @@ object NCStart extends App with LazyLogging {
* @param msgs
*/
def error(msgs: String*): Unit = {
- val NL = System getProperty "line.separator"
val ver = NCVersion.getCurrent
- val s = NL +
- raw" _ ____ ______ ______ $NL" +
- raw" / | / / /___ / ____/________ _/ __/ /_ $NL" +
- raw" / |/ / / __ \/ / / ___/ __ `/ /_/ __/ $NL" +
- raw" / /| / / /_/ / /___/ / / /_/ / __/ /_ $NL" +
- raw"/_/ |_/_/ .___/\____/_/ \__,_/_/ \__/ $NL" +
- raw" /_/ $NL$NL" +
- s"Version: ${ver.version}$NL" +
- raw"${NCVersion.copyright}$NL"
-
- logger.info(s)
+ logger.info(
+ U.NL +
+ U.asciiLogo() +
+ s"${U.NL}" +
+ s"Version: $ansiBold${ver.version}${U.NL}$ansiReset" +
+ s"${NCVersion.copyright}${U.NL}"
+ )
for (msg ← msgs)
logger.error(msg)
- logger.info("Usage:")
+ logger.info(s"${ansiGreenFg}Usage:$ansiReset")
logger.info(" Use '-server' argument to start server.")
logger.info(" Use '-probe' argument to start probe.")
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
index 4a3d21a..859a977 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/common/util/NCUtils.scala
@@ -69,6 +69,8 @@ object NCUtils extends LazyLogging {
final val DFLT_PROBE_TOKEN = "3141592653589793"
+ final val NL = System getProperty "line.separator"
+
private val idGen = new NCIdGenerator(NCBlowfishHasher.salt(), 8)
// Various decimal formats.
@@ -1358,6 +1360,18 @@ object NCUtils extends LazyLogging {
}
/**
+ * Prints ASCII-logo.
+ */
+ def asciiLogo(): String =
+ raw"$ansiBlueFg _ ____ $ansiCyanFg ______ ______
$ansiReset$NL" +
+ raw"$ansiBlueFg / | / / /___ $ansiCyanFg/ ____/________ _/ __/ /_
$ansiReset$NL" +
+ raw"$ansiBlueFg / |/ / / __ \$ansiCyanFg/ / / ___/ __ `/ /_/ __/
$ansiReset$NL" +
+ raw"$ansiBlueFg / /| / / /_/ /$ansiCyanFg /___/ / / /_/ / __/ /_
$ansiReset$NL" +
+ raw"$ansiBlueFg/_/ |_/_/ .___/$ansiCyanFg\____/_/ \__,_/_/ \__/
$ansiReset$NL" +
+ raw"$ansiBlueFg /_/
$ansiReset$NL"
+
+
+ /**
* Unzips file.
*
* @param zipFile Zip file.
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
index 4231712..c5909c8 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/probe/NCProbeBoot.scala
@@ -338,22 +338,16 @@ private [probe] object NCProbeBoot extends LazyLogging
with NCOpenCensusTrace {
* Prints ASCII-logo.
*/
private def asciiLogo() {
- val NL = System getProperty "line.separator"
-
val ver = NCVersion.getCurrent
-
- val s = NL +
- raw" _ ____ ______ ______ $NL" +
- raw" / | / / /___ / ____/________ _/ __/ /_ $NL" +
- raw" / |/ / / __ \/ / / ___/ __ `/ /_/ __/ $NL" +
- raw" / /| / / /_/ / /___/ / / /_/ / __/ /_ $NL" +
- raw"/_/ |_/_/ .___/\____/_/ \__,_/_/ \__/ $NL" +
- raw" /_/ $NL$NL" +
- s"Embedded Data Probe$NL" +
- s"Version: ${ver.version}$NL" +
- raw"${NCVersion.copyright}$NL"
-
- println(s)
+
+ println(
+ U.NL +
+ U.asciiLogo() +
+ s"${U.NL}" +
+ s"Embedded Data Probe${U.NL}" +
+ s"Version: $ansiBold${ver.version}${U.NL}$ansiReset" +
+ s"${NCVersion.copyright}${U.NL}"
+ )
}
/**
@@ -364,7 +358,7 @@ private [probe] object NCProbeBoot extends LazyLogging with
NCOpenCensusTrace {
val ver = NCVersion.getCurrent
- tbl += ("Probe ID", s"$ansiBlackFg$ansiBlueBg${cfg.id}$ansiReset")
+ tbl += ("Probe ID", s"$ansiReversed${cfg.id}$ansiReset")
tbl += ("Probe Token", cfg.token)
tbl += ("API Version", ver.version + ", " + ver.date.toString)
tbl += ("Down-Link", cfg.downLinkString)
diff --git a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
index c9424e7..83bae94 100644
--- a/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
+++ b/nlpcraft/src/main/scala/org/apache/nlpcraft/server/NCServer.scala
@@ -22,6 +22,7 @@ import java.util.concurrent.CountDownLatch
import com.typesafe.config.Config
import com.typesafe.scalalogging.LazyLogging
import org.apache.nlpcraft.common._
+import org.apache.nlpcraft.common.ansi.NCAnsiColor._
import org.apache.nlpcraft.common.ascii.NCAsciiTable
import org.apache.nlpcraft.common.config.NCConfigurable
import org.apache.nlpcraft.common.extcfg.NCExternalConfigManager
@@ -63,21 +64,16 @@ object NCServer extends App with NCIgniteInstance with
LazyLogging with NCOpenCe
* Prints ASCII-logo.
*/
private def asciiLogo() {
- val NL = System getProperty "line.separator"
val ver = NCVersion.getCurrent
-
- val s = NL +
- raw" _ ____ ______ ______ $NL" +
- raw" / | / / /___ / ____/________ _/ __/ /_ $NL" +
- raw" / |/ / / __ \/ / / ___/ __ `/ /_/ __/ $NL" +
- raw" / /| / / /_/ / /___/ / / /_/ / __/ /_ $NL" +
- raw"/_/ |_/_/ .___/\____/_/ \__,_/_/ \__/ $NL" +
- raw" /_/ $NL$NL" +
- s"Server$NL" +
- s"Version: ${ver.version}$NL" +
- raw"${NCVersion.copyright}$NL"
-
- logger.info(s)
+
+ logger.info(
+ U.NL +
+ U.asciiLogo() +
+ s"${U.NL}" +
+ s"Server${U.NL}" +
+ s"Version: $ansiBold${ver.version}${U.NL}$ansiReset" +
+ s"${NCVersion.copyright}${U.NL}"
+ )
}
/**