Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Node.js module to display messages on the screen, and update the state asyncronously
JavaScript
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
index.js
package.json
readme.md
test.js

readme.md

termite

Display messages on the screen, and update the state asynchronously.

Screenshot

Installation

$ npm install termite

Usage

var termite = require('termite');
var update = termite.write("Hello World");

// terminal is updated to show:
// [ .... ] Hello World

update("WAIT");

// terminal is updated to show:
// [ WAIT ] Hello World

update.ok();

// terminal is updated to show:
// [  OK  ] Hello World

Multiple messages can be written out, and updated in any order, after any amount of time. The update function can also be called multiple times, but you won't see the update once it's off the top of the screen.

It support the following convenience methods:

update.ok()                     // outputs 'OK' in green
update.warning()                // outputs 'WARN' in yellow
update.error()                  // outputs 'ERROR' in red
update("anything")              // outputs 'anything'
update("anything", "magenta")   // outputs 'anything' in magenta

Supported colours include black, red, green, yellow, blue, magenta, cyan, white.

You can adjust the space given for the status update with the updateSettings function:

termite.updateSettings({
    placeholderCharacter : "*",
    statusLength : 10
});

Known limitations

  • Lines off the top of the screen aren't updated
  • Strange things happen when text wraps
  • Doesn't play nicely with other things writing to stdout

License

MIT

Something went wrong with that request. Please try again.