xterm-js-shell
Building block for CLI environments for xterm.js
<script src="//unpkg.com/xterm-js-shell/bundle.js"></script>
-- OR --
npm install --save xterm-js-shell
const XtermJSShell = require('xterm-js-shell/bundle.js')
const terminal = const shell = terminal shell // Start the Read-Eval-Print-Loopshell terminal
Features:
- Takes an
xterm.js
terminal instance - Keyboard navigation, history, tab completion using local-echo
- Able to define commands with a name and an async function or an async generator
- Commands take a
shell
instance, andargs
array - Commands should be able to
readLine
,readChar
from the shell - Commands can
yield
data from the generator for output, or invokeprint
/printLine
- Commands should be abele to read raw data from the terminal as a stream
- After a command resolves or rejects, it's
shell
should throw whenever there's input - Commands should be able to "take over" the terminal to prevent default processing
- Useful for stuff like SSH
- Shell will take back control after the program exits
- Able to
detach
shell from the terminal