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


The following commit(s) were added to refs/heads/master by this push:
     new 401df1f  Update NCCli.scala
401df1f is described below

commit 401df1f9e411dc04465177ef7bbd607d5fbde119
Author: Aaron Radzinski <[email protected]>
AuthorDate: Fri Nov 20 12:45:40 2020 -0800

    Update NCCli.scala
---
 .../nlpcraft/model/tools/cmdline/NCCli.scala       | 34 +++++++++++-----------
 1 file changed, 17 insertions(+), 17 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 5fe1dfb..dfe26f3 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
@@ -2257,11 +2257,19 @@ object NCCli extends App {
         if (args.size > 1)
             throw TooManyArguments(cmd)
 
+        val nanoArgs: Array[String] =
+            if (args.isEmpty)
+                Array()
+            else if (args.head.parameter.id == "file")
+                Array(stripQuotes(args.head.value.get))
+            else
+                Array(getServerLogFromBeacon)
+
         Commands.nano(term,
             System.out,
             System.err,
             Paths.get(""),
-            nanoLessArgs(args)
+            nanoArgs
         )
     }
 
@@ -2284,21 +2292,6 @@ object NCCli extends App {
 
     /**
      *
-     * @param args
-     * @return
-     */
-    private def nanoLessArgs(args: Seq[Argument]): Array[String] = {
-        if (args.head.parameter.id == "file")
-            Array(ensureFileExists(stripQuotes(args.head.value.get)))
-        else {
-            require(args.head.parameter.id == "server-log")
-
-            Array(getServerLogFromBeacon)
-        }
-    }
-
-    /**
-     *
      * @param cmd  Command descriptor.
      * @param args Arguments, if any, for this command.
      * @param repl Whether or not executing from REPL.
@@ -2309,12 +2302,19 @@ object NCCli extends App {
         else if (args.size > 1)
             throw TooManyArguments(cmd)
 
+        val arg = args.head
+
+        val lessArgs = if (arg.parameter.id == "file")
+            Array(ensureFileExists(stripQuotes(arg.value.get)))
+        else
+            Array(getServerLogFromBeacon)
+
         Commands.less(term,
             System.in,
             System.out,
             System.err,
             Paths.get(""),
-            nanoLessArgs(args)
+            lessArgs
         )
     }
 

Reply via email to