This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-346
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-346 by this push:
new b3d8dab WIP
b3d8dab is described below
commit b3d8dab83e42d5ed98b46b15c3f9ab0fba7d9cef
Author: Aaron Radzinzski <[email protected]>
AuthorDate: Sun Jun 27 22:50:54 2021 -0700
WIP
---
.../org/apache/nlpcraft/model/tools/cmdline/NCCli.scala | 15 +++++++++++++--
.../nlpcraft/model/tools/cmdline/NCCliCommands.scala | 14 ++++++++++++--
2 files changed, 25 insertions(+), 4 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 b26e8ac..115c2ea 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
@@ -2286,13 +2286,20 @@ object NCCli extends NCCliBase {
private def mkCandidate(disp: String, grp: String, desc: String,
completed: Boolean): Candidate =
new Candidate(disp, disp, grp, desc, null, null, completed)
+ private def isFsPath(cmd: String, param: String): Boolean = {
+ println(s"Word: $s")
+
+ false
+ }
+
override def complete(reader: LineReader, line: ParsedLine,
candidates: util.List[Candidate]): Unit = {
val words = line.words().asScala
if (words.nonEmpty && words.head.nonEmpty && words.head.head
== '$') { // Don't complete if the line starts with '$'.
// No-op.
}
- else if (words.isEmpty || !cmds.map(_._1).contains(words.head))
+ else if (words.isEmpty || (words.size == 1 &&
!cmds.map(_._1).contains(words.head))) {
+ // Add all commands as a candidates.
candidates.addAll(cmds.map(n => {
val name = n._1
val desc = n._2.substring(0, n._2.length - 1) //
Remove last '.'.
@@ -2305,6 +2312,10 @@ object NCCli extends NCCliBase {
completed = true
)
}).asJava)
+ }
+ else if (words.size > 1 && isFsPath(words.head, words.last)) {
+
+ }
else {
val cmd = words.head
@@ -2326,7 +2337,7 @@ object NCCli extends NCCliBase {
completed = !hasVal
))
})
- .asJava
+ .asJava
case None => Seq.empty[Candidate].asJava
})
diff --git
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
index 02b292d..0ab0689 100644
---
a/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
+++
b/nlpcraft/src/main/scala/org/apache/nlpcraft/model/tools/cmdline/NCCliCommands.scala
@@ -84,6 +84,7 @@ private [cmdline] case class Parameter(
names: Seq[String],
value: Option[String] = None,
optional: Boolean = false, // Mandatory by default.
+ fsPath: Boolean = false, // Not a file system path by default.
synthetic: Boolean = false,
desc: String
) {
@@ -113,7 +114,7 @@ private [cmdline] object NCCliCommands {
Parameter(
id = "path",
names = Seq("--path", "-p"),
- value = Some("path"),
+ value = Some("rest"),
desc =
s"REST path, e.g. ${y("'signin'")} or
${y("'ask/sync'")}. " +
s"Note that you don't need supply '/' at the
beginning. " +
@@ -221,7 +222,7 @@ private [cmdline] object NCCliCommands {
Parameter(
id = "path",
names = Seq("--path", "-p"),
- value = Some("path"),
+ value = Some("rest"),
desc =
s"REST path, e.g. ${y("'signin'")} or
${y("'ask/sync'")}. " +
s"Note that you don't need supply '/' at the
beginning. " +
@@ -390,6 +391,7 @@ private [cmdline] object NCCliCommands {
id = "cp",
names = Seq("--cp", "-p"),
value = Some("path"),
+ fsPath = true,
optional = true,
desc =
s"Additional JVM classpath that will be appended to
the default NLPCraft JVM classpath. " +
@@ -662,6 +664,7 @@ private [cmdline] object NCCliCommands {
id = "config",
names = Seq("--cfg", "-c"),
value = Some("path"),
+ fsPath = true,
optional = true,
desc =
s"Configuration file path. Server will automatically
look for ${y("'server.conf'")} " +
@@ -674,6 +677,7 @@ private [cmdline] object NCCliCommands {
id = "igniteConfig",
names = Seq("--igniteCfg", "-i"),
value = Some("path"),
+ fsPath = true,
optional = true,
desc =
s"Apache Ignite configuration file path. Note that
Apache Ignite is used as a cluster " +
@@ -733,6 +737,7 @@ private [cmdline] object NCCliCommands {
id = "cp",
names = Seq("--cp", "-p"),
value = Some("path"),
+ fsPath = true,
desc =
s"Additional JVM classpath that will be appended to
the default NLPCraft JVM classpath. " +
s"When starting a probe with your own models you must
" +
@@ -743,6 +748,7 @@ private [cmdline] object NCCliCommands {
id = "config",
names = Seq("--cfg", "-c"),
value = Some("path"),
+ fsPath = true,
optional = true,
desc =
s"Configuration file path. Probe will automatically
look for ${y("'probe.conf'")} " +
@@ -824,6 +830,7 @@ private [cmdline] object NCCliCommands {
id = "cp",
names = Seq("--cp", "-p"),
value = Some("path"),
+ fsPath = true,
desc =
s"Additional JVM classpath that will be appended to
the default NLPCraft JVM classpath. " +
s"Although this configuration property is optional,
when testing your own models you must " +
@@ -835,6 +842,7 @@ private [cmdline] object NCCliCommands {
id = "config",
names = Seq("--cfg", "-c"),
value = Some("path"),
+ fsPath = true,
optional = true,
desc =
s"Configuration file path. By default, the embedded
probe will automatically look for ${y("'probe.conf'")} " +
@@ -1089,6 +1097,7 @@ private [cmdline] object NCCliCommands {
id = "outputDir",
names = Seq("--outputDir", "-d"),
value = Some("path"),
+ fsPath = true,
optional = true,
desc =
s"Output directory. Default value is the current
working directory. " +
@@ -1157,6 +1166,7 @@ private [cmdline] object NCCliCommands {
id = "filePath",
names = Seq("--filePath", "-f"),
value = Some("path"),
+ fsPath = true,
desc =
s"File path for the model stub. File path can either
be an absolute path, relative path or " +
s"just a file name in which case the current folder
will be used. File must have one of the " +