kagami

Simple terminal mirroring for Node.js

npm install kagami
4 downloads in the last month

Kagami - Simple terminal mirroring for Node.js

Contents

  1. Install
  2. Introduction
  3. API
  4. License


Install

npm install kagami


Introduction

Kagami allows you to run an emulated terminal within an existing Node.js process.

node server.js

Listening for connections at http://localhost:3000

kagami

===========================
= kagami terminal started =
===========================

kagami:~ pachet$ pwd
/home/pachet/examples/kagami
kagami:~ pachet$ echo nifty!
nifty!
kagami:~ pachet$ exit

===========================
= closing kagami terminal =
===========================


API


General Usage

To enable Kagami in your Node application, just require it:

var kagami = require('kagami');

Now when you run the application, you can type 'kagami' or 'kg' in the terminal to start Kagami. Run whatever commands you want, then type 'exit' in the terminal to close the Kagami session.

You can also add an optional command for Kagami to run on startup, eg:

kagami pwd && ls

===========================
= kagami terminal started =
===========================

kagami:~ pachet$ pwd && ls
/home/pachet/examples/kagami
README.md    index.js    package.json


kagami.start()

If you have assigned Kagami to a variable within your Node application, you can programmatically start a Kagami session by calling kagami.start():

var kagami = require('kagami');
kagami.start();
//===========================
//= kagami terminal started =
//===========================
//
//kagami:~ pachet$


kagami.stop()

You can also kill the current Kagami session by calling kagami.stop():

var kagami = require('kagami');
kagami.start();
//===========================
//= kagami terminal started =
//===========================
//
//kagami:~ pachet$

kagami.stop();
//===========================
//= closing kagami terminal =
//===========================


License

Kagami is MIT licensed. You can read the license here.

npm loves you