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/17 21:33:04 UTC

[incubator-nlpcraft] branch NLPCRAFT-198 updated: Update NCCli.scala

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

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


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

commit bdcbe9cc86c5b53474c0a8799f690e27ebc2e569
Author: Aaron Radzinski <ar...@datalingvo.com>
AuthorDate: Thu Dec 17 13:32:49 2020 -0800

    Update NCCli.scala
---
 .../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala  | 16 +++++++++++++---
 1 file changed, 13 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 71e5c7e..23ebe24 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
@@ -2442,8 +2442,10 @@ object NCCli extends App {
             new File(SystemUtils.getUserHome, HIST_PATH).getAbsolutePath
         )
 
-        logln(s"Hit ${rv(" Tab ")} or type '${c("help")}' to get help and ${rv(" ↑ ")} or ${rv(" ↓ ")} to scroll through history.")
-        logln(s"Type '${c("quit")}' to exit.")
+        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.")
 
         var exit = false
 
@@ -2457,6 +2459,8 @@ object NCCli extends App {
 
         pinger.start()
 
+        var wasLastLineEmpty = false
+
         while (!exit) {
             val rawLine = try {
                 val acsTokStr = bo(s"${state.accessToken.getOrElse("N/A")} ")
@@ -2466,7 +2470,9 @@ object NCCli extends App {
                 val prompt3 = wb(k(s" acsTok: $acsTokStr")) // Access token, if any.
                 val prompt4 = kb(g(s" ${Paths.get("").toAbsolutePath} ")) // Current working directory.
 
-                reader.printAbove("\n" + prompt1 + ":" + prompt2 + ":" + prompt3 + ":" + prompt4)
+                if (!wasLastLineEmpty)
+                    reader.printAbove("\n" + prompt1 + ":" + prompt2 + ":" + prompt3 + ":" + prompt4)
+
                 reader.readLine(s"${g(">")} ")
             }
             catch {
@@ -2485,6 +2491,8 @@ object NCCli extends App {
                     .trim()
 
                 if (line.nonEmpty) {
+                    wasLastLineEmpty = false
+
                     try
                         doCommand(splitAndClean(line), repl = true)
                     catch {
@@ -2501,6 +2509,8 @@ object NCCli extends App {
                     if (line == QUIT_CMD.name)
                         exit = true
                 }
+                else
+                    wasLastLineEmpty = true
             }
         }