xterminal
v2.1.9
Published
Build web-based cli interfaces
Downloads
271
Maintainers
Readme
Overview
Welcome to XTerminal!
This library provides a simple, lightweight and perfomant solution for creating interactive web-based command-line interfaces (CLIs) with ease in your web applications. It aims to be a minimalist dependency-free alternative to popular libraries like jquery.terminal, offering improved performance and a simplified approach.
Inspiration
This project draws inspiration from the powerful node:readline module in Node.js, which has proven to be a reliable and efficient tool for command-line interactions. Additionally, inspiration is derived from the versatility and functionality of xterm.js, a widely adopted library for web-based terminal emulators.
By combining the best features and ideas from these sources, this library aims to provide an accessible and performant solution for creating web-based CLIs that meet the needs of modern web applications.
Live Demo
There is a quick demo online: Try It Yourself.
Getting Started
Installation
To install xterminal
, use npm:
npm install xterminal
alternatively use unpkg or jsdelivr.
Basic Usage
Import the package and create a new instance of the XTerminal
class:
<link rel='stylesheet' href='https://unpkg.com/xterminal/dist/xterminal.css'>
<div id="app"></div>
<script src='https://unpkg.com/xterminal/dist/xterminal.umd.js'></script>
<script>
const term = new XTerminal()
term.mount('#app');
term.write('Hello World!\n# ');
</script>
For more detailed information, please refer to the official documentation online.
Documentation
The complete documentation for XTerminal
can be found here. It provides detailed information on installation, configuration, usage, and advanced features. You'll also find code examples and API references.
The full Public API for XTerminal
can also be found within this TypeScript declaration file.
Showcase
Several projects that are using XTerminal are listed here. Feel free to open a pull request adding your project in this file.
Browser Support
Supporting wide range of browsers is the goal. Modern browsers, most specifically the latest versions of Chrome, Firefox, Safari, and Edge (for desktop and mobile devices) are supported.
Contributing
Thank you for checking out this awesome project. Any contributions to the project are appreciated, whether it's fixing bugs, adding new features, or improving documentation. To contribute, please follow these guidelines:
- Issues: Before starting to work on a new feature or bug fix, please check the issue tracker to see if the task is already in progress or has been reported. If not, feel free to open a new issue to discuss the proposed changes or bug fixes.
- Branching: Create a new branch for each feature or bug fix you are working on. Use clear descriptive branch names that reflect the purpose of your changes e.g.
feature/events
orbugfix/issue-1234
.
Development
To get started with development, follow these steps:
Prerequisites
Setup
- Clone this repository:
git clone https://github.com/henryhale/xterminal.git
- Navigate to the project directory:
cd xterminal
- Install dependencies:
pnpm install
- Start the development server:
pnpm dev
Building the Library
To build the library, run pnpm build
This will generate the production-ready distribution files in the dist
directory.
Related
- chalk-dom - Chalk for the browser
- inken - Terminal-like string styling for the browser
- viteshell - A minimal bash-like shell implementation written in TypeScript
License
Copyright (c) 2023 Henry Hale.
Released under the MIT License.