JOSH.js
Javascript Online SHell
Because every site deserves a CLI
Arne Claassen
@sdether
MindTouch
JOSH.js
Javascript Online SHell
Because every site deserves a CLI
Arne Claassen
@sdether
MindTouch
WHAT is READLINE
"GNU readline is a software library that provides line-editing and history capabilities for
interactive programs with a command-line interface, such as Bash."
josh.js provides native javascript readline support
What's in josh.js?
- Readline
- History
- by default backed by local storage
- Killring
- Shell
- Basic text shell
- Tab completion
- Reverse search
- Command handling
- PathHandler
- support for unix style path hierarchy navigation
Command Handlers
shell.setCommandHandler("command", {
exec: function (cmd, args, callback) {
...
}
);
Completion Handlers
shell.setCommandHandler("command", {
exec: ...,
completion: function (cmd, arg, line, callback) {
...
}
);
Path Handling
Node format
{
name: 'localname',
path: '/full/path/to/localname'
}
getNode
pathhandler.getNode = function(path, callback) {
// call callback with a node
};
getChildNodes
pathhandler.getChildNodes = function(node, callback) {
// call callback with an array of nodes
}
THANKS
Arne Claassen
@sdether
MindTouch