From a519add247dc09daea9f1fa4b1aab57ae650cf9a Mon Sep 17 00:00:00 2001
From: Rafael Bey <24432403+rafaelbey@users.noreply.github.com>
Date: Thu, 21 Mar 2024 19:50:37 -0400
Subject: [PATCH] Support for REPL client on windows (#2721)
---
.../legend-engine-repl-client-windows/pom.xml | 45 +++++++++++++++++++
.../repl/client/jline3/JLine3Parser.java | 10 ++++-
.../legend-engine-repl/pom.xml | 1 +
pom.xml | 10 +++++
4 files changed, 65 insertions(+), 1 deletion(-)
create mode 100644 legend-engine-config/legend-engine-repl/legend-engine-repl-client-windows/pom.xml
diff --git a/legend-engine-config/legend-engine-repl/legend-engine-repl-client-windows/pom.xml b/legend-engine-config/legend-engine-repl/legend-engine-repl-client-windows/pom.xml
new file mode 100644
index 00000000000..83209a28898
--- /dev/null
+++ b/legend-engine-config/legend-engine-repl/legend-engine-repl-client-windows/pom.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+ legend-engine-repl
+ org.finos.legend.engine
+ 4.42.1-SNAPSHOT
+
+ 4.0.0
+
+ legend-engine-repl-client-windows
+ Legend Engine - REPL - Client - Windows
+ pom
+
+
+
+ org.finos.legend.engine
+ legend-engine-repl-client
+
+
+ org.jline
+ jline-terminal-jansi
+
+
+ org.fusesource.jansi
+ jansi
+
+
+
diff --git a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/client/jline3/JLine3Parser.java b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/client/jline3/JLine3Parser.java
index eb434dcd24f..0fef62df797 100644
--- a/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/client/jline3/JLine3Parser.java
+++ b/legend-engine-config/legend-engine-repl/legend-engine-repl-client/src/main/java/org/finos/legend/engine/repl/client/jline3/JLine3Parser.java
@@ -44,7 +44,15 @@ public MyParsedLine(ParserResult result)
@Override
public String word()
{
- return result.words.get(wordIndex());
+ int index = wordIndex();
+ if (result.words.size() > index)
+ {
+ return result.words.get(index);
+ }
+ else
+ {
+ return "";
+ }
}
@Override
diff --git a/legend-engine-config/legend-engine-repl/pom.xml b/legend-engine-config/legend-engine-repl/pom.xml
index 36599f2530a..d049d459d8b 100644
--- a/legend-engine-config/legend-engine-repl/pom.xml
+++ b/legend-engine-config/legend-engine-repl/pom.xml
@@ -28,6 +28,7 @@
legend-engine-repl-client
+ legend-engine-repl-client-windows
legend-engine-repl-relational
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index ca42dfbdc1c..1a6cc973be8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3550,6 +3550,16 @@
jline
3.25.0
+
+ org.jline
+ jline-terminal-jansi
+ 3.25.0
+
+
+ org.fusesource.jansi
+ jansi
+ 2.4.1
+