Allows you to turn any HTMLInputElement into a terminal interface. Define custom commands that can be executed by users, track command history, autocomplete commands, and more.
HTMLInputElement
import { Terminal, Command } from "input-terminal";import { DOMOutputAdapter } from "input-terminal/dom";const input = document.getElementById("terminal") as HTMLInputElement;const output = document.getElementById("output") as HTMLElement;const terminal = new Terminal({ input, output: new DOMOutputAdapter(output), options: { prompt: ">> " },});terminal.bin.add(new Command("echo", (args, options, terminal) => { terminal.stdout(args.join(" ")); return {};}));terminal.init(); Copy
import { Terminal, Command } from "input-terminal";import { DOMOutputAdapter } from "input-terminal/dom";const input = document.getElementById("terminal") as HTMLInputElement;const output = document.getElementById("output") as HTMLElement;const terminal = new Terminal({ input, output: new DOMOutputAdapter(output), options: { prompt: ">> " },});terminal.bin.add(new Command("echo", (args, options, terminal) => { terminal.stdout(args.join(" ")); return {};}));terminal.init();
Optional
Allows you to turn any
HTMLInputElementinto a terminal interface. Define custom commands that can be executed by users, track command history, autocomplete commands, and more.Example