Skip to content

klassmann/termjs

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

Term.js

It's a basic terminal implemented in pure Javascript, it provides a basic REPL and you can customize how the commands are interpreted.

Features

  • Basic shell
  • Custom command interpreter
  • Pure javascript and withour dependencies
  • Command highlighting
  • Command history
  • Quoted arguments support (strings)
  • Suggestion and autocompletion
  • Tab keys and arrow keys movement
  • Output coloring (VT100 emulation or something like that)

Customized

Usage

    <link rel="stylesheet" href="term.css">
    <script src="term.js"></script>

Options

Term.js has only one option, that is the class for read and run the commands:

    var term = new Terminal(document.querySelector(".terminal"), {
        interpreterClass: MyCustomClass // The default is the DummyInterpreter
    });

Example

    window.addEventListener('load', () => {
        var terminal = new Terminal(document.querySelector(".terminal"));
        terminal.writeLine("***************************************");
        terminal.writeLine("* Welcome to Term.js                 *");
        terminal.writeLine("***************************************");
        terminal.start();
    });

I am adding more examples in termjs/examples folder.

Screenshots

Basic Old School

License

Apache 2.0

About

A basic Terminal idea in Javascript (Vanilla)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published