http://sdether.github.io/josh.js/
Javascript Online SHell provides a toolkit for building bash-like command line consoles for web pages. JOSH enables the visitor who prefers the bash-like command to maneuver through web content using a console rather than clicking with a mouse. This toolkit is most useful for people who like to use command line because it is faster and more effective than using a mouse. It is easier and convienent to access hierarchical information using JOSH command history, change or display current directory. It consists of the following components:
readline.js
- full readline support for ctrl sequences, tab, history, etc.shell.js
- visual presentation of the shell and command handlingpathhandler.js
- provide cd, ls, pwd and path completion toolikithistory.js
- localStorage backed command historykillring.js
- killring for kill & yank handling in readlineJosh allows developers to build their own command line interface to any sites. It supports full CLI Readline in the browser like TAB completion, emacs-style line editing, killring and history with reverse search. When you are tired of clicking your way through a hierachy tree, Josh will come in handy. It will helps you browse or navigate text files quickly and minimal the using of mouse click.
ls
,
cd
, pwd
and bash filename tab-completionjosh.js is licensed under the Apache 2.0 License
more
-like handling for output that exceeds the shell viewport sizeUntil documentation is written, refer to index.html
and example.js
(Annotated Source) for a sample implementation of a shell with path completion.
josh is built from 5 components and can be used in part or in full.
readline.js
has no dependencies on any outside libraries, although it requires either history.js
and killring.js
or objects implementing the same calls.
It implements key trapping to bring GNU Readline like line editing to the browser. It can be used by itself to bring readline support to custom data entry fields or in conjunction with shell.js
to create a full console.
In the below C-x
refers to the Ctrl-x
keystroke, while M-x
refers to the Meta-x
keystroke which is mapped to Alt
, ⌘
and Left Windows
.
C-b
or Left Arrow
M-b
or Right Arrow
C-f
M-f
C-a
or Home
C-e
or End
Backspace
C-d
or Delete
C-k
M-Backspace
M-d
C-y
M-y
C-r
C-p
or Up Arrow
C-n
or Down Arrow
Page Up
Page Down
C-l
Tab
Esc
in reverse searchC-c
onCancel
handlerC-d
on empty lineonCancel
handlershell.js
has external dependencies of jQuery, Underscore and internal dependencies of readline.js
and history.js
.
It provides a simple console UI, using a panel for the console viewport and an auto-scrolling view inside the panel. It uses Underscore templates for generating the view html, although any template generator can be substituted as long as it can be expressed in the form of a function that takes a JSON object of arguments and returns an html string.
It also implements command handling so that new commands can be added by name with execution and completion handlers. Out of the box, shell.js
provides the following commands:
readline.js
in history.js
pathhandler.js
is a mix in to easily add the cd
, ls
and pwd
commands as well as path completion. It has the same external dependencies of jQuery, Underscore as shell.js
and also uses Underscore templating.
By implementing the functions getNode
and getChildNodes
, this library adds path traversal, discovery and completion just like a bash shell.
history.js
implements a localStorage back command history storage that persists over page changes and reloads. It is used by the shell.js
history command to list all executed commands, and by readline.js
for up/down arrow and reverse search capabilities.
killring.js
implements the kill and yank behavior as well as state tracking, i.e. multiple consecutive kills are combined as a single kill and killring rotation tracks the previous yank, so that the readline.js
can remove the previous yank and replace it with the rotated text.
0.2.10 -- 2014/04/03
0.2.9 -- 2013/08/31
0.2.8 -- 2013/03/13
0.2.7 -- 2013/02/13
Shell.templates
, so that they can easily be customized (see: Issue 11)PathHandler.templates
. PathHandler now attches its templates to Shell.templates
as well0.2.6 -- 2013/01/21
M-d
not deleting last character of line0.2.5 -- 2013/01/14
0.2.4 -- 2013/01/14
0.2.3 -- 2013/01/13
0.2.2 -- 2013/01/09
0.2.1 -- 2013/01/08
0.2 -- 2013/01/07
onEnter
callback0.1 -- 2013/01/04