NordicPlayground / pc-xterm-lib

Other
2 stars 0 forks source link

pc-xterm-lib

This library implements a set of useful features for a rich terminal experience. It is implemented as a modular set of addons for the main XTerm.js library, so it can be used by any application which uses XTerm.js and would benefit from a terminal with these features.

It should not be considered remotely production ready; there are lots of bugs and missing features, and a lot of polish needed before it can be used in a real application.

Features

Usage

Since the library is a normal XTerm addon, usage is as straightforward as initialising it and passing it to your terminal's loadAddon method:

import { Terminal } from 'xterm';
import { NrfTerminalCommander, NrfTerminalConfig } from 'pc-xterm-lib';

const config: NrfTerminalConfig = {
    completions: [
        {
            name: 'my_custom_command',
            description: 'Does something interesting',
        },
    ],
    commands: {
        my_custom_command: () => {
            console.log('Doing something...');
        },
    },
    prompt: 'AT[:lineCount]>',
    showTimestamps: true,
};

const nrfTerminalCommander = new NrfTerminalCommander(config);

const terminal = new Terminal();
terminal.loadAddon(nrfTerminalCommander);

Architecture

Please see the diagram below and this presentation for information on how the library is structured.

architecture_no_alpha

Feedback

Please report issues to the Wayland team.

License

See the LICENSE file for details.