This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-108
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-108 by this push:
new b4770c2 WIP.
b4770c2 is described below
commit b4770c2f6ce8471dca0d8ccdb6dae50221a75f4e
Author: Aaron Radzinski <[email protected]>
AuthorDate: Mon Sep 14 11:40:00 2020 -0700
WIP.
---
.../org/apache/nlpcraft/common/util/NCUtils.scala | 4 +--
.../model/tools/cmdline/NCCommandLine.scala | 34 ++++++++++++----------
2 files changed, 21 insertions(+), 17 deletions(-)
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 398cc97..edc7dd4 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
@@ -1376,8 +1376,8 @@ object NCUtils extends LazyLogging {
raw"$ansiBlueFg / | / / /___ $ansiCyanFg/ ____/________ _/ __/ /_
$ansiReset$NL" +
raw"$ansiBlueFg / |/ / / __ \$ansiCyanFg/ / / ___/ __ `/ /_/ __/
$ansiReset$NL" +
raw"$ansiBlueFg / /| / / /_/ /$ansiCyanFg /___/ / / /_/ / __/ /_
$ansiReset$NL" +
- raw"$ansiBlueFg/_/ |_/_/ .___/$ansiCyanFg\____/_/ \__,_/_/ \__/
$ansiReset$NL" +
- raw"$ansiBlueFg /_/
$ansiReset$NL"
+ raw"$ansiBold$ansiRedFg/_/ |_/_/ .___/${ansiRedFg}\____/_/ \__,_/_/
\__/ $ansiReset$NL" +
+ raw"$ansiBold$ansiRedFg /_/
$ansiReset$NL"
/**
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
index 3469d14..a4e8af0 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCommandLine.scala
@@ -18,7 +18,8 @@
package org.apache.nlpcraft.model.tools.cmdline
import org.apache.nlpcraft.common.ascii.NCAsciiTable
-import org.apache.nlpcraft.common.util.NCUtils
+import org.apache.nlpcraft.common._
+import org.apache.nlpcraft.common.ansi.NCAnsiColor._
import org.apache.nlpcraft.common.version.NCVersion
import scala.collection.mutable
@@ -29,10 +30,10 @@ object NCCommandLine extends App {
private final val NAME = "Apache NLPCraft CLI"
private final lazy val VER = NCVersion.getCurrent
- private final lazy val INSTALL_HOME =
NCUtils.sysEnv("NLPCRAFT_CLI_INSTALL_HOME").getOrElse(
+ private final lazy val INSTALL_HOME =
U.sysEnv("NLPCRAFT_CLI_INSTALL_HOME").getOrElse(
assert(assertion = false, "System property 'NLPCRAFT_CLI_INSTALL_HOME'
not defined.")
)
- private final lazy val SCRIPT_NAME =
NCUtils.sysEnv("NLPCRAFT_CLI_SCRIPT").getOrElse(
+ private final lazy val SCRIPT_NAME =
U.sysEnv("NLPCRAFT_CLI_SCRIPT").getOrElse(
assert(assertion = false, "System property 'NLPCRAFT_CLI_SCRIPT' not
defined.")
)
@@ -256,13 +257,14 @@ object NCCommandLine extends App {
*
*/
def header(): Unit = log(
- s"""|NAME
+ s"""|${U.asciiLogo()}
+ |${ansiBold}NAME${ansiReset}
|$T___$SCRIPT_NAME - command line interface to control
NLPCraft.
|
- |USAGE
+ |${ansiBold}USAGE${ansiReset}
|$T___$SCRIPT_NAME [COMMAND] [PARAMETERS]
|
- |COMMANDS""".stripMargin
+ |${ansiBold}COMMANDS${ansiReset}""".stripMargin
)
/**
@@ -280,14 +282,16 @@ object NCCommandLine extends App {
if (cmd.params.nonEmpty) {
lines += ""
- lines += "PARAMETERS:"
+ lines += s"${ansiBold}PARAMETERS:${ansiReset}"
for (param ← cmd.params) {
- if (param.valueDesc.isDefined)
- lines += T___ +
param.names.zip(Stream.continually(param.valueDesc.get)).map(t ⇒
s"${t._1}=${t._2}").mkString(", ")
- else
- lines += s"$T___${param.names.mkString(", ")}"
+ val line =
+ if (param.valueDesc.isDefined)
+ T___ +
param.names.zip(Stream.continually(param.valueDesc.get)).map(t ⇒
s"${t._1}=${t._2}").mkString(", ")
+ else
+ s"$T___${param.names.mkString(", ")}"
+ lines += s"${ansiCyanFg}$line${ansiReset}"
if (param.optional)
lines += s"$T___${T___}Optional."
@@ -301,7 +305,7 @@ object NCCommandLine extends App {
if (cmd.examples.nonEmpty) {
lines += ""
- lines += "EXAMPLES:"
+ lines += s"${ansiBold}EXAMPLES:${ansiReset}"
for (ex ← cmd.examples) {
lines += s"$T___${ex.code}"
@@ -318,7 +322,7 @@ object NCCommandLine extends App {
header()
CMDS.foreach(cmd ⇒ tbl +/ (
- "" → cmd.names.mkString(", "),
+ "" → cmd.names.mkString(ansiGreenFg, ", ", ansiReset),
"align:left, maxWidth:65" → cmd.synopsis
))
@@ -329,7 +333,7 @@ object NCCommandLine extends App {
CMDS.foreach(cmd ⇒
tbl +/ (
- "" → cmd.names.mkString(", "),
+ "" → cmd.names.mkString(ansiGreenFg, ", ", ansiReset),
"align:left, maxWidth:65" → mkCmdLines(cmd)
)
)
@@ -349,7 +353,7 @@ object NCCommandLine extends App {
case Some(c) ⇒
if (!seen.contains(c.id)) {
tbl +/ (
- "" → c.names.mkString(", "),
+ "" → cmd.names.mkString(ansiGreenFg,
", ", ansiReset),
"align:left, maxWidth:65" →
mkCmdLines(c)
)