Skip to content

Commit 5405e3b

Browse files
committed
aesh running working on scala native package
1 parent 8d48847 commit 5405e3b

File tree

1 file changed

+33
-31
lines changed

1 file changed

+33
-31
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,50 @@
11
package org.esmerilprogramming.scalaesh
22

3-
import java.io.File
4-
import java.nio.file._
5-
6-
import org.jboss.aesh.cl._
73
import org.jboss.aesh.console._
8-
import org.jboss.aesh.console.command._
9-
import org.jboss.aesh.console.command.invocation._
104
import org.jboss.aesh.console.command.registry._
115
import org.jboss.aesh.console.settings._
12-
import org.jboss.aesh.extensions.harlem.aesh._
6+
import org.jboss.aesh.extensions.harlem.aesh.Harlem
137
import org.jboss.aesh.extensions.pwd._
14-
import java.io._
8+
import org.jboss.aesh.extensions.mkdir._
9+
import org.jboss.aesh.extensions.rm._
10+
import org.jboss.aesh.extensions.echo._
11+
import org.jboss.aesh.extensions.matrix._
12+
import org.jboss.aesh.extensions.cat._
13+
import org.jboss.aesh.extensions.touch._
14+
import org.jboss.aesh.extensions.cd._
15+
import org.jboss.aesh.extensions.ls._
16+
import org.jboss.aesh.extensions.clear._
1517

1618
import org.jboss.aesh.terminal.{Color, TerminalColor, TerminalString, TestTerminal}
1719

1820

1921
/**
2022
* simple aesh scala wrapper.
21-
* author helio frota at gmail dot com.
23+
* @author <a href="mailto:00hf11@gmail.com">Helio Frota</a>
2224
*/
2325
object ScalaeshApp extends App {
2426

25-
val pos = new PipedOutputStream();
26-
val pis = new PipedInputStream(pos);
27-
val baos = new ByteArrayOutputStream();
28-
29-
val sb = new SettingsBuilder()
30-
.terminal(new TestTerminal())
31-
.inputStream(pis)
32-
.outputStream(new PrintStream(baos))
33-
34-
val registry = new AeshCommandRegistryBuilder()
35-
.command(new Harlem())
36-
.command(new Pwd())
37-
.create();
38-
39-
val aeshConsole = new AeshConsoleBuilder()
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-
46-
aeshConsole.start();
27+
val sb = new SettingsBuilder();
28+
sb.readInputrc(false);
29+
sb.logging(true);
30+
31+
val acr = new AeshCommandRegistryBuilder();
32+
acr.command(new Pwd());
33+
acr.command(new Clear());
34+
acr.command(new Harlem());
35+
acr.command(new Cat());
36+
acr.command(new Touch());
37+
acr.command(new Cd());
38+
acr.command(new Ls());
39+
acr.command(new Matrix());
40+
acr.command(new Mkdir());
41+
acr.command(new Echo());
42+
acr.command(new Rm());
43+
44+
val acb = new AeshConsoleBuilder()
45+
acb.commandRegistry(acr.create());
46+
acb.settings(sb.create());
47+
acb.prompt(new Prompt("[scalaesh@localhost]$ "));
48+
acb.create().start();
4749

4850
}

0 commit comments

Comments
 (0)