Skip to content

Commit 8d48847

Browse files
committed
trying to start an aesh console from scala
1 parent 796fddd commit 8d48847

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

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

+16-14
Original file line numberDiff line numberDiff line change
@@ -13,34 +13,36 @@ import org.jboss.aesh.extensions.harlem.aesh._
1313
import org.jboss.aesh.extensions.pwd._
1414
import java.io._
1515

16-
import org.jboss.aesh.terminal.TestTerminal
16+
import org.jboss.aesh.terminal.{Color, TerminalColor, TerminalString, TestTerminal}
1717

1818

1919
/**
20-
* simple aesh scala wrapper.
21-
* author helio frota at gmail dot com.
22-
*/
20+
* simple aesh scala wrapper.
21+
* author helio frota at gmail dot com.
22+
*/
2323
object ScalaeshApp extends App {
2424

2525
val pos = new PipedOutputStream();
2626
val pis = new PipedInputStream(pos);
2727
val baos = new ByteArrayOutputStream();
2828

2929
val sb = new SettingsBuilder()
30-
.terminal(new TestTerminal())
31-
.inputStream(pis)
32-
.outputStream(new PrintStream(baos))
30+
.terminal(new TestTerminal())
31+
.inputStream(pis)
32+
.outputStream(new PrintStream(baos))
3333

3434
val registry = new AeshCommandRegistryBuilder()
35-
.command(new Harlem())
36-
.command(new Pwd())
37-
.create();
35+
.command(new Harlem())
36+
.command(new Pwd())
37+
.create();
3838

3939
val aeshConsole = new AeshConsoleBuilder()
40-
.commandRegistry(registry)
41-
.settings(sb.create())
42-
.prompt(new Prompt("$ "))
43-
.create();
40+
.commandRegistry(registry)
41+
.settings(sb.create())
42+
.prompt(new Prompt(new TerminalString("[scalaesh@metal]$ ",
43+
new TerminalColor(Color.GREEN, Color.DEFAULT, Color.Intensity.BRIGHT))))
44+
.create();
45+
4446
aeshConsole.start();
4547

4648
}

0 commit comments

Comments
 (0)