DEV Community

Cover image for Built a cli for browser
Raj Nandan Sharma
Raj Nandan Sharma

Posted on

Built a cli for browser

Termo

Termo is a simple terminal emulator that can be used to create a terminal-like interface on your website. It is inspired by the terminal emulator in stripe.dev. It is an wrapper on top of xterm.js.


Demo

Check out the

demo and documentation.

github

Features

  • [x] Customizable terminal title, prompt, font, and theme
  • [x] Set a welcome message for the terminal
  • [x] Add and execute any javascript as commands
  • [x] Control sound effects
  • [x] Get full access to the terminal (xterm.js)
  • [x] Set terminal to dock/floating mode

Installation

Include the following script tag in your HTML file.

<script src="https://cdn.jsdelivr.net/gh/rajnandan1/termo/dist/termo.min.js"></script>
Enter fullscreen mode Exit fullscreen mode

Quick Start

Create a new instance of Termo by passing an object .

const myTermo = new termo({
    title: 'Termo',
    welcomeMessage: 'Welcome to Termo',
    commands: [
        {
            command: 'hello',
            description: 'Says hello',
            action: async (terminal, args) => terminal.write('\r\nHello! ' + args.join(' ')),
        },
    ],
});
myTermo.create();
myTermo.show();
Enter fullscreen mode Exit fullscreen mode

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay