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 2021/07/28 22:50:30 UTC
[incubator-nlpcraft] branch NLPCRAFT-375 updated: FIx for
NLPCRAFT-375.
This is an automated email from the ASF dual-hosted git repository.
aradzinski pushed a commit to branch NLPCRAFT-375
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git
The following commit(s) were added to refs/heads/NLPCRAFT-375 by this push:
new fef7822 FIx for NLPCRAFT-375.
fef7822 is described below
commit fef78224c1b52b6fd21fc3af6be33b4e48f21604
Author: Aaron Radzinzski <ar...@datalingvo.com>
AuthorDate: Wed Jul 28 15:50:22 2021 -0700
FIx for NLPCRAFT-375.
---
.../nlpcraft/model/tools/cmdline/NCCli.scala | 26 +++++++++-------------
1 file changed, 11 insertions(+), 15 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 8394d99..0d67d5d 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
@@ -2460,12 +2460,8 @@ object NCCli extends NCCliBase {
override def complete(reader: LineReader, line: ParsedLine, candidates: java.util.List[Candidate]): Unit = {
val words = line.words().asScala
- // Don't complete if the line starts with '$'.
- if (words.nonEmpty && words.head.nonEmpty && words.head.head == '$') {
- // No-op.
- }
// Complete command names.
- else if (words.isEmpty || (words.size == 1 && !cmds.map(_._1).contains(words.head))) {
+ 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
@@ -2481,7 +2477,7 @@ object NCCli extends NCCliBase {
}).asJava)
}
// Complete path for OS commands (starting with '$').
- else if (words.head.head == '$' && words.last.contains(PATH_SEP_STR)) {
+ else if (words.nonEmpty && words.head.nonEmpty && words.head.head == '$' && words.last.contains(PATH_SEP_STR)) {
var path = words.last // Potential path.
var prefix = ""
@@ -2499,16 +2495,16 @@ object NCCli extends NCCliBase {
suffix = last.toString
path = path.dropRight(1)
}
-
- fsCompleter.fillCandidates(
- reader,
- null,
- path,
- prefix,
- suffix,
- candidates
- )
}
+
+ fsCompleter.fillCandidates(
+ reader,
+ null,
+ path,
+ prefix,
+ suffix,
+ candidates
+ )
}
// Complete paths for commands.
else if (words.size > 1 && isFsPath(words.head, words.last))