Skip to content

Commit 862b524

Browse files
committed
trying to call aesh from scala
1 parent ef04b72 commit 862b524

File tree

1 file changed

+31
-4
lines changed

1 file changed

+31
-4
lines changed

src/main/scala/org/eprogramming/scalaesh/ScalaeshApp.scala

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,39 @@ package org.esmerilprogramming.scalaesh
33
import java.io.File
44
import java.nio.file._
55

6+
import org.jboss.aesh.cl._
7+
import org.jboss.aesh.console._
8+
import org.jboss.aesh.console.command._
9+
import org.jboss.aesh.console.command.invocation._
10+
import org.jboss.aesh.console.command.registry._
11+
import org.jboss.aesh.console.settings._
12+
import org.jboss.aesh.extensions.harlem.aesh._
13+
import org.jboss.aesh.extensions.pwd._
14+
import java.io._
15+
16+
617
/**
7-
* main app.
18+
* simple aesh scala wrapper.
819
* author helio frota at gmail dot com.
920
*/
1021
object ScalaeshApp extends App {
11-
println("--------------------")
12-
println("initial structure...")
13-
println("--------------------")
22+
23+
val pos = new PipedOutputStream();
24+
val pis = new PipedInputStream(pos);
25+
val sb = new SettingsBuilder()
26+
.inputStream(pis)
27+
.outputStream(new MtermPrintStream(textSpace, baos));
28+
29+
val registry = new AeshCommandRegistryBuilder()
30+
.command(new Harlem())
31+
.command(new Pwd())
32+
.create();
33+
34+
val aeshConsole = new AeshConsoleBuilder()
35+
.commandRegistry(registry)
36+
.settings(sb.create())
37+
.prompt(new Prompt("$ "))
38+
.create();
39+
aeshConsole.start();
40+
1441
}

0 commit comments

Comments
 (0)