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.
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.
There is a quick demo online: Try It Yourself.
To install xterminal
, use npm:
npm install xterminal
alternatively use unpkg or jsdelivr.
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.
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.
Several projects that are using XTerminal are listed here. Feel free to open a pull request adding your project in this file.
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.
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
.
To get started with development, follow these steps:
- 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
To build the library, run pnpm build
This will generate the production-ready distribution files in the dist
directory.
- chalk-dom - Chalk for the browser
- inken - Terminal-like string styling for the browser
- viteshell - A minimal bash-like shell implementation written in TypeScript
Copyright (c) 2023 Henry Hale.
Released under the MIT License.