Package detail

linespin

geekjuice20MIT0.2.0

Simple progress output

readme

linespin

Simple progress output

Extracted from music.json

Why?

It's nice to know that your program is running and not dead with a simple spinner animation

Usage

  $ npm install linespin
  // linespin_example.js

  var Linespin = require('./linespin');

  // Create new instance of linespin
  var linespin = new Linespin('Spinning...', 'All done!', 100);

  // Start spinner at beginning of task
  linespin.start();


  // Some long running task...
  linespin.error('Error!');

  // Continuing process...
  linespin.warn('Warning!');

  // Say something...
  linespin.msg('Hello world!');

  // Results down the line...
  var results = 42;

  // Stop at the end of task and overwrite message with results
  linespin.stop('The answer is ' + results);
  $ node linespin_example.js
    [/] Spinning...

  # During process...

  $ node linespin_example.js
    [!] Error!          # Red
    [!] Warning!        # Yellow
    [•] Hello world!    # White
    [-] Spinning...     # Yellow/Blue

  # On finish

  $ node linespin_example.js
    [!] Error!            # Red
    [!] Warning!          # Yellow
    [•] Hello world!      # White
    [✓] The answer is 42  # Green/Blue

Notes

  • Assumes your progress does not print to console/stdout as the spinner works by replacing the same line over and over again to produce the animation
  • Add editable color and symbol options
  • Add replace text method to replace current text i.e. Progress done
  • Aggregate message output methods (wet code...)
  • Overwrite console.log or provide similar function i.e. @message
  • Need to add Gruntfile

License

Linespin is released under the MIT License.

changelog

2014-01-30

  • Fix issue of starting spinning rewriting line when it should start new

2014-01-29

  • Add simple msg output since console outputs get overwritten otherwise
  • Aggregate message and use prettify helper

2014-01-19

  • Ability to overwrite stop message (pull request)

2014-01-06

  • Pull from music.json
  • Added Gruntfile
  • Fix speed issue
  • Add ability to add interrupted messages (error and warnings)