Skip to content

Commit f18ce15

Browse files
author
“Per
committed
Added documentation.
1 parent 7893aaa commit f18ce15

File tree

1 file changed

+54
-9
lines changed

1 file changed

+54
-9
lines changed

README.md

Lines changed: 54 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
# JWebTerminal - a web-based console
22

33
JWebTerminal implements a general-purpose interactive console:
4-
Users can type commands which get sent to a command handler,
4+
Users can type commands which gets sent to an application,
55
which evaluates the command, and displays the results, typically
66
in some kind of type-script format.
77

88
There are two basic modes:
99
- In line-editing mode each input line is an input field you
1010
edit locally (in the browser). The finished line is sent to the
11-
client when you type Enter.
12-
- In character mode each character is sent directly to the client,
11+
application when you type Enter.
12+
- In character mode each character is sent directly to the application,
1313
which is also responsible for input echoing.
1414

1515
Applications of JWebTerminal include:
@@ -18,7 +18,13 @@ Applications of JWebTerminal include:
1818
- A command console.
1919
- A terminal emulator.
2020

21-
WebTerminal recognizes a large subset of the standard ANSI/xterm
21+
JWebTerminal is a rough and incomplete prototype. It is meant to
22+
demo my belief that a modern terminal emulator should be based
23+
on a web browser engine. It seems reasonable to re-write the "guts"
24+
of the terminal emulator code in JavaScript (rather than Java),
25+
to make the code useful in non-Java context.
26+
27+
JWebTerminal recognizes a large subset of the standard ANSI/xterm
2228
terminal escape sequences for repositioning the cursor, erasing
2329
previous text, changing style, etc. Enough of a subset is recognized
2430
that you can run programs like the emacs text editor, with styling.
@@ -32,15 +38,37 @@ The terminfo directory defines the escape sequences supported by the
3238
"jfxterm" terminal type, using a terminfo descriptor. The terminal emulation
3339
is a subset of the standard xterm/ansi/vt100 ones.
3440

41+
JWebTerminal handles automatic line-wrapping, distinguishing between
42+
explicit line-breaks and those caused by line-wrapping. This allows
43+
for re-flow on windows re-size (though that is not yet implemented),
44+
and "intelligent" cut-and-paste (also not yet implemented).
45+
3546
There is an escape sequence to send HTML to WebTerminal.
3647
This allows you to embed images, forms, and other HTML elements
3748
in the console output.
3849

3950
The primary class is webterminal.WebTerminal, which is
40-
an abstract (overridable) control you embed in your scenegraph.
51+
an abstract (overridable) control you embed in your JavaFX scenegraph.
52+
53+
## Building and running
54+
55+
The prototype requires not only Java, but specifically JavaFX 2.x.
56+
The latter is bundled with JDK 8.x. JavaFX is also distributed
57+
with newer releases of JDK 7.x; however, you may have to manually
58+
set the classpath to include jfxrt.jar.
59+
60+
Build the library and sample applications with the Ant tool:
61+
$ ant
62+
63+
The PtyConsole requires non-portable native code, so it is
64+
not built by default. Build it with:
65+
$ ant all
4166

4267
## Sample Applications
4368

69+
These sample applications are very simple. There is currently no
70+
menues or other "chrome" beside the actual WebTerminal window.
71+
4472
#### RunInConsole
4573

4674
The utility class webterminal.RunInConsole make it easy to
@@ -49,11 +77,16 @@ It re-binds System.in, System.out, and System.err to the WebTerminal.
4977

5078
For example, the jrunscript tool is a wrapper around the class
5179
com.sun.tools.script.shell.Main in tools.jar. So to start up
52-
a JavaScript read-elal-print-tool, do:
80+
a JavaScript read-eval-print-tool, do:
81+
82+
$ ant run-main -Drunmain.classpath=$JAVA_HOME/lib/tools.jar \
83+
-Drunmain.class="com.sun.tools.script.shell.Main" \
84+
-Drunmain.args="-l javascript"
85+
or:
86+
$ java -cp dist/WebTerminal.jar:${JAVA_HOME}/lib/tools.jar \
87+
webterminal.RunInConsole com.sun.tools.script.shell.Main -l javascript
5388

54-
$ ant run-main -Drunmain.classpath=$JAVA_HOME/lib/tools.jar \
55-
-Drunmain.class="com.sun.tools.script.shell.Main" \
56-
-Drunmain.args="-l javascript"
89+
This uses line-editing mode.
5790

5891
#### ShellConsole
5992

@@ -62,6 +95,14 @@ to run a process inside a WebTerminal. Currently, it is hard-wired to
6295
run /bin/bash. (It does work under Cygwin if you edit the
6396
commandWithArgs field.)
6497

98+
You can start this using Ant:
99+
$ ant run
100+
or directly:
101+
$ java -cp dist/WebTerminal.jar:${JAVA_HOME}/lib/tools.jar \
102+
webterminal.ShellConsole
103+
104+
This also uses line-editing mode.
105+
65106
#### PtyConsole
66107

67108
An application that implements a terminal emulator
@@ -75,3 +116,7 @@ pseudo-teletypes. At the time of writing it has only been tested on
75116
GNU/Linux Fedora 21; it may need some porting effort on older
76117
or non-Linux platforms, especially Windows.
77118

119+
You can run this with Ant:
120+
$ ant run-pty
121+
122+
This uses character mode.

0 commit comments

Comments
 (0)