# easy-terminal

> An easy to use web terminal without any dependency and minified.

Latest version **1.1.3** (published 2022-12-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install easy-terminal
pnpm add easy-terminal
yarn add easy-terminal
bun add easy-terminal
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2022-12-21 |
| First published | 2022-11-21 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 32.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Paul Richez |
| Maintainers | paulrichez |
| Keywords | terminal js |

## Links

- npm: https://www.npmjs.com/package/easy-terminal
- Repository: https://github.com/PaulRichez/easy-terminal
- Homepage: https://github.com/PaulRichez/easy-terminal#readme
- Issues: https://github.com/PaulRichez/easy-terminal/issues
- npm.io page: https://npm.io/package/easy-terminal

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2022-12-21
- 1.1.2 — 2022-12-21
- 1.1.1 — 2022-12-15
- 1.1.0 — 2022-12-15
- 1.0.2 — 2022-12-15
- 1.0.1 — 2022-11-28
- 1.0.0 — 2022-11-21

## README

# Easy terminal

An easy to use web terminal without any dependency and minified.

[Demo](https://easy-terminal.vercel.app/)


## Installation

```
npm i easy-terminal
```

## Usage

see the [example folder](https://github.com/PaulRichez/easy-terminal/tree/master/example/vanillaJS) for a complete case.


```js
import { EasyTerminal } from './node_modules/easy-terminal/index.js';
const terminalElement = window.document.getElementById('terminal'); // div where you want the terminal
new EasyTerminal({
    elementHtml: terminalElement,
    window: { show: true, title: 'EasyTerminal' },
    nativeCommands: true,
    welcome: 'Welcome to EasyTerminal',
    history: true,
    noEmptyCommand: true,
    customCommands: [
        {
            name: 'test',
            help: 'test command',
            method: async function (cmd) {
                return await cmd.select(objTest, true)
            }
        },
        {
            name: 'test2',
            help: 'test2 command',
            method: async function (cmd) {
                return await cmd.select(stringsTest, false)
            }
        },
        {
            name: 'askAge',
            help: 'ask age to user',
            method: async function (cmd) {
                const age = await cmd.ask('age ?', true);
                cmd.echo('Age: ' + age);
            }
        }
    ]
});
```

## Config
#### Terminal Config
| name           | type             | default | desc                                                 |
| -------------- | ---------------- | ------- | ---------------------------------------------------- |
| window         | Object           | N/A     | Some style for the termianal                         |
| welcome        | String           | null    | Welcome message (first line)                         |
| elementHtml    | HTMLElement      | null    | div where you want the terminal                      |
| data-ps        | string           | $       | Char before command input                            |
| history        | boolean          | false   | If yes you can access history with arrow up and down |
| noEmptyCommand | boolean          | false   | If true cancel empty command                         |
| nativeCommands | boolean          | false   | Native commands are help and clear                   |
| customCommands | ITerminalCommand | N/A     | Pass you're commands here                            |

#### Window interface
 | name      | type    | default        | desc                |
 | --------- | ------- | -------------- | ------------------- |
 | show      | boolean | false          | Show a window       |
 | title     | string  | 'EasyTerminal' | Title of the window |
 | bgColor   | string  | #198754        | Background color    |
 | textColor | string  | white          | Text color          |
#### ITerminalCommand interface
 | name   | type     | required | desc                      |
 | ------ | -------- | -------- | ------------------------- |
 | name   | string   | true     | Command name              |
 | method | function | true     | function called           |
 | help   | string   | true     | Text show on help command |

 ## License
[ISC](https://gist.github.com/indexzero/10602128#file-isc-md)

---
_Source: https://npm.io/package/easy-terminal · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
