0.1.3 • Published 4 years ago

uterminal v0.1.3

Weekly downloads
2
License
MIT
Repository
github
Last release
4 years ago

UTerminal

Open source, front end terminal with following features:

  • Easy to integrate in Vanilla HTML/JS projects as well as typescript
  • Supports command/Input suggestions
  • Autosaves all commands to for quick reload with up and down arrow
  • Set the UI with CSS library

Install using npm

npm install uterminal

How to use

HTML

<div style="width: 200px; height: 500px;" class="uterminal" id="terminal-id"></div>

Javascript

 const terminal = new UTerminal("terminal-id", "signature");
 terminal.init();
 terminal.newCommandLine();
 terminal.onNewCommand(command => {
     // handle command here
	 console.log(command);
	 terminal.write("Response");
	 terminal.newCommandLine();
 });

 //Suggest complete command when user types it partially. 
 // User can type TAB to accept the input
 terminal.giveCommandSuggestion(userInput => {
	 //Example of suggestion for Hello World as a valid user command
	 if (userInput === "He") {
		 return "llo world!"
	 }
	 return "";
 });

See Live Working here