Home > Web Front-end > JS Tutorial > Built a cli for browser

Built a cli for browser

DDD
Release: 2024-12-20 14:09:09
Original
991 people have browsed it

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>
Copy after login

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();
Copy after login

The above is the detailed content of Built a cli for browser. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template