Home

Awesome

Observatory Build Status

Beautiful UI for showing tasks running on the command line.

Purpose

Instead of just logging long running tasks to the console, give your users a simple status dashboard.

observatory

Installation

$ npm install observatory

Examples

node ./examples/buzzwords.js

An example using fake data that tries to look like a real-world usage.

node ./examples/long-line.js

An example of what happens when text is so long it needs to wrap to another line.

Usage Example

var observatory = require('observatory');

//add a task to display
var task = observatory.add('Install packages...');

//while working on the task, update the status
task.running('Copying Files');

//optionally give details
task.details(percent + '% ' + filename);

//chain commands
task.status('Compressing Images')
    .details(directoryName);

//when complete
task.done('Finished!');

//or if it failed
task.fail('Ooops');

Terminology

[Test Runner] Running tests on Safari  Running Now  50%  CSS3 Tests
⇧ prefix      ⇧ description            ⇧ status     ⇧ details

API

observatory.add(description)

description string Required description.
returns a new task

Adds a task to the console. This method returns a task object, you should store it in a variable so you can use it for the methods bellow.

var copyFilesTask = observatory.add('Copy files');

Task Methods

All task methods return the task object so that you can chain functions, such as task.done().status('Installed!');.

task.status(statusLabel)

statusLabel string Set the status value.

Displays a short message to the right of the description. Use it to show users in a word or two that suggests what is happening.

Examples:

task.details(detailsLabel)

detailsLabel string Set the details value.

Optional provide details about what's happening, such as file names, urls, tests names.

Examples:

task.done(statusLabel)

statusLabel string Set the status value. Default: ✓ Done.

task.fail(statusLabel)

statusLabel string Set the status value. Default: ✗ Failed.

Override Settings

observatory.settings(settingsObject)

Tweak how tasks are rendered.

settingsObject

returns observatory so you can use it on the require statement.

var observatory = require('observatory').settings({
  prefix: '[bower] '.white
});

observatory.STATE

A constant for the different states. Only useful if you need to change formatStatus above.

The values:

Acknowledgements

Inspiration

Release History

License

Copyright (c) 2015 Dylan Greene
Licensed under the MIT license.