JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 277
  • Score
    100M100P100Q76327F
  • License MIT

A library to update stdout output.

Package Exports

  • cli-update

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cli-update) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

cli-update

Patreon PayPal AMA Version Downloads Get help on Codementor

A library to update stdout output.

☁️ Installation

$ npm i --save cli-update

📋 Example

// Dependencies
var CliUpdate = require("cli-update")
  , CliBox = require("cli-box")
  , Couleurs = require("couleurs")()
  , Figlet = require("figlet")
  ;

// http://stackoverflow.com/a/16426519/1420197
function getDateTime() {

    var date = new Date();

    var hour = date.getHours();
    hour = (hour < 10 ? "0" : "") + hour;

    var min  = date.getMinutes();
    min = (min < 10 ? "0" : "") + min;

    var sec  = date.getSeconds();
    sec = (sec < 10 ? "0" : "") + sec;

    return hour + " : " + min + " : " + sec;
}

// Render time in a fancy format
setInterval(function () {
    Figlet(getDateTime(), function(err, data) {
        data = data.split("\n").map(function (c) { return Couleurs.bg(c, "#c0392b") + "\u001b[45m"; }).join("\n");
        CliUpdate.render(
            CliBox({
                fullscreen: true
              , marks: {}
            }, data).split("\n").map(function (c) {
                return Couleurs.bg(c, "#2980b9");
            }).join("\n")
        );
    });
}, 1000);

📝 Documentation

render(output, pushHistory, data, emitChanged)

Render the current output.

Params

  • String output: The output that should be printed in stdout.
  • Boolean pushHistory: Push or not push the output in history (default: true).
  • Object data:
  • Boolean emitChanged: Call or not call the changed handler (deafult: true).

Return

  • Object The CliUpdate object.

back()

Go to the previous output in the history.

Return

  • Object The CliUpdate object.

next()

Go to the next output in the history.

Return

  • Object The CliUpdate object.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

💰 Donations

Another way to support the development of my open-source modules is to set up a recurring donation, via Patreon. 🚀

PayPal donations are appreciated too! Each dollar helps.

Thanks! ❤️

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

📜 License

MIT © Ionică Bizău