• Stars
    star
    239
  • Rank 165,152 (Top 4 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 12 years ago
  • Updated over 9 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Terminal supporting inline HTML

Note: even though the project might seem dead, I do use this terminal. It just happens to be good enough for my purposes so I don't bother updating it. If you have trouble making it work, have suggestions or want to contribute anything, please do tell me about it :)

Terminus - VT100 emulator + inline HTML

Terminus is a terminal emulator with the ability to create and manipulate inline HTML cells in addition to plain text. In its current state, it can already serve as an xterm replacement (bar some escape codes that are not yet supported).

For the most part, Terminus plays nice with existing UNIX utilities: I have organized most of its capabilities in a line-based approach, so notwithstanding one or two gotchas, they play nice with command-line utilities such as grep or sed. Since it's all based on escape codes, the enhanced display options also work through SSH.

Install

Terminus requires node and its package manager, npm, to be installed.

# Start the server
cd path/to/terminus
cd server
npm install
node terminus-server.js server.yaml

# open the client (chrome recommended, but firefox should work ok)
google-chrome http://localhost:8181/bash

You can also go to /debug or /python instead of /bash. Read the server.yaml file.

If you don't want to mess with an existing, more recent version of node, you can install node 0.5.9 in some isolated place with configure --prefix=~/local, or you can omit make install and run /path/to/node/out/Release/node.

There's also a Python server but it's pretty bad compared to the node one (plus, I broke it). You can go back in time on the repo (Feb 15-ish) if you want to try that.

IMPORTANT: client/server communication is not encrypted at all (for the time being - integrating ssl should be easy enough). Only run Terminus locally, and don't run it on a shared machine!

IMPORTANT: using escape codes, programs can do arbitrary javascript injection, and this includes simulating keyboard strokes and typing commands on your shell. Because of this, it is technically possible for serious wreckage to occur with a mere cat of a malicious file. Anybody who can tell me how to properly sandbox JavaScript within JavaScript to avoid this gets a cookie.

Using

Terminus is used much like a normal xterm. You can run commands like top, emacs, vi, ipython or ssh without many problems. Not all escape codes are handled yet and there might be some slight bugs in those that are, so commands like reset (!) and screen are iffy, and for some reason ipython seems to show the wrong colors. You can paste with Ctrl+V or the mouse wheel.

You can start exploring with the applications that are in bin/. So far, they are dr, show, tcmd, box and xkcd. You will have to add them to your PATH in order to execute them unqualified.

I have taken screenshots of myself using each of the commands. I think they speak for themselves.

dr

dr

show

show

xkcd

xkcd

box

box

tcmd

tcmd1

(note: the tb example doesn't work like that anymore, you now have to use \t as a separator instead of a space)

tcmd2

The Terminus server gives access to the filesystem in /f/user@host/path/from/root, so you can link to files or images on the filesystem that way.

So, you see, it's really easy. Since it works with escape codes on stdout, you can take advantage of the features in any language without any special libraries, and it works through plain SSH as well (except obviously for the fact that the remote filesystem is not mounted by default - but you can do it with sshfs and config).

Useful shortcuts

Shift-Space <letter>: Same as Control-<letter>, but since most browsers don't allow catching some shortcuts (e.g. Control-w) this is the only way to send some control codes. I might change that binding, because it's too easy to accidentally hit shift-space right after a shifted characted.

Control-Shift-b: Drop all unprocessed characters in the queue. This is handy if a program prints data faster than Terminus can handle it.

Control-Shift-c Space: Clear elements that are absolutely positioned at the top, left, right and bottom of the terminal screen, if they are present.

Control-Shift-d <shortcut>: bypasses Terminus's key bindings and uses the browser's default bindings instead. For instance, C-S-d C-l will focus the url bar.

Control-Shift-l: Clear all lines in the scrollback.

F5: Refresh the page. This does not terminate your session and will solve most problems, at the expense of losing the screen's contents and the scrollback.

The list of key bindings can be found here.

Documentation

See protocol, commands, apps.

Configuration

See server/server.yaml and resources/settings/default.yaml. The options are extensive (including nearly total customization of key bindings), and documented. If you change default.yaml you can just refresh the page to see the changes (you won't lose your session - it will connect right back to it).

More Repositories

1

jurigged

Hot reloading for Python
Python
993
star
2

earl-grey

Programming language compiling to JavaScript
JavaScript
468
star
3

quaint

The Quaint markup language
q
33
star
4

liso

Operator syntax for the Lisp family of languages (Racket implementation)
Racket
31
star
5

py-quaint

Terse and highly extensible markup language
Python
27
star
6

hrepr

HTML representation for Python objects.
HTML
13
star
7

coleo

The nicest way to develop a command-line interface in Python
Python
10
star
8

engage

Incremental build system
8
star
9

breakword

Mixing breakpoints with print debugging
Python
8
star
10

ovld

Advanced multiple dispatch for Python functions
Python
8
star
11

synecure

Simple rsync-based synchronization CLI program
Python
7
star
12

adhoc

Command-line utility to run code snippets in arbitrary languages on a per-line basis.
Ruby
6
star
13

ptera

Query and override internal variables in your programs
Python
5
star
14

exc

Exception class for Python that can be subclassed with __getitem__
Python
5
star
15

buche

Tool to display rich logs.
CSS
5
star
16

earl-react

Earl Grey macros for React
5
star
17

bugland

Dataset generator
Python
5
star
18

starbear

Create simple local web apps in Python
Python
5
star
19

old_quaint

New programming language
Python
4
star
20

teacup

Short implementation of a simple programming language.
JavaScript
4
star
21

ug

The Unholy Grail language
Python
3
star
22

inquirer-shortcuts

Promise wrapper for inquirer
JavaScript
3
star
23

earl-shapely

Earl Grey macros for shapely
3
star
24

earl-gulp

Earl Grey macros for gulp
2
star
25

histocit

Track number of citations on Google Scholar
Python
1
star
26

kaiser

Serialization library
JavaScript
1
star
27

earlify

browserify transform for Earl Grey
1
star
28

earl-autodiff

Autodiff for Earl Grey
1
star
29

earl-debug

Debugging tools for Earl Grey
1
star
30

descr

Customizable HTML pretty-printing
Python
1
star
31

pytest-ptera

Test using Ptera probes
Python
1
star
32

earl-grey-mode

earl-mode for Emacs
Emacs Lisp
1
star
33

tlaloc

Python
1
star
34

hyper-replace

Replace patterns in strings by arbitrary objects
JavaScript
1
star
35

fluogames

IRC bot for games
Python
1
star
36

milatools-bk

Tools to connect to and interact with the Mila cluster
Python
1
star
37

quaint-katex

Inline math for Quaint using KaTeX
JavaScript
1
star
38

generator-earl-package

Generate scaffolding for an npm package written in Earl Grey.
JavaScript
1
star
39

ursa-major

Define structs with field types, validation and serialization
1
star
40

js-spacebear

SPACE BEAR
1
star
41

opg

Operator precedence grammars
JavaScript
1
star
42

codefind

Find code objects and their referents
Python
1
star
43

myia_debug

Debugging tools for Myia
Python
1
star
44

colonel

Graph-based virtual machine
Python
1
star
45

earl-mocha

Earl Grey wrapper around the Mocha testing framework
1
star