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 49b1629 Update NCCli.scala
49b1629 is described below
commit 49b1629dc5e2b9960aa6a898b6dbcc95312ad092
Author: Aaron Radzinski <[email protected]>
AuthorDate: Sat Oct 3 23:50:13 2020 -0700
Update NCCli.scala
---
.../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 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 797cff0..dcf8811 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
@@ -597,15 +597,22 @@ object NCCli extends App {
)
/**
+ *
+ * @return
+ */
+ private def getRestEndpointFromBeacon: String =
+ loadServerBeacon() match {
+ case Some(beacon) ⇒ s"http://${beacon.restEndpoint}"
+ case None ⇒ throw new IllegalStateException(s"Cannot detect
locally running REST server.")
+ }
+
+ /**
* @param cmd Command descriptor.
* @param args Arguments, if any, for this command.
* @param repl Whether or not executing from REPL.
*/
private def cmdPingServer(cmd: Command, args: Seq[Argument], repl:
Boolean): Unit = {
- val endpoint = loadServerBeacon() match {
- case Some(beacon) ⇒ s"http://${beacon.restEndpoint}"
- case None ⇒ throw new IllegalStateException(s"Cannot detect
locally running REST server.")
- }
+ val endpoint = getRestEndpointFromBeacon
val num = args.find(_.parameter.id == "number") match {
case Some(arg) ⇒
@@ -927,7 +934,7 @@ object NCCli extends App {
* @param repl Whether or not executing from REPL.
*/
private def cmdRest(cmd: Command, args: Seq[Argument], repl: Boolean):
Unit = {
- // TODO
+ val endpoint = getRestEndpointFromBeacon
}
/**