Neverending Programming Mistakes
    Share your code. npm Orgs help your team discover, share, and reuse code. Create a free org »

    status-linepublic

    Status Line


    Allows for simple one-line status displaying with progress animation (finite or infinite) while retaining the logging ability. Writes only to stdout through readline, for no TTY falls back to console.log.

    Usage

    var sl = require('status-line');
    
    sl('Waiting...');
    sl.log('Hello world!');
    // 'Waiting…' remains the last line 
    // with progress animation
    
    var p = 0;
    sl.progress(p, 'Working on something');
    var intId = setInterval(function () {
      sl.progress(++p/10);
      if (p === 10) {
        sl.finish('All stuff is done');
        clearInterval(intId);
      }
    }, 500);
    

    Methods (all chainable):

    log, warn, error - log a message while still retaining the status line.
    fatalError - kill execution with an error message.

    pause, resume - hide/show progress animation.
    hide, show - hide/show the status line altogether.
    show is actually an alias to the main function. Without a new message, the last one will be displayed.

    progress(progress, [message]) - displays a finite progress bar. Progress must be between 0 and 1. Pass false in the first argument to return to infinite progress animation.

    timeless, timestamped - turn on/off time displaying.

    lap - log a message in green (to show that one of the tasks is finished) finish - must be called when your script finished all tasks.

    All methods except hide can receive a message as argument.

    Keywords

    none

    install

    npm i status-line

    Downloadslast 7 days

    2

    version

    0.0.1

    license

    none

    last publish

    collaborators

    • avatar