np-cli

No-problem CLI library written in ES6

View the Project on GitHub zen-np/np-cli

np-cli

No-problem CLI library written in ES6.

Introduction

This is yet another CLI utility library for Node but with the added twist of being written in ECMAScript 6 syntax to the extent supported by traceur from @google.

Installing

If you just want to use the library you do not have to install the traceur compiler. The published module is pre-compiled to ECMAScript 5 compatible code.

Simply install using npm in the root of your project folder, like any other module:

$ npm i np-cli --save

Tinkering

If you want to poke around in the code and see what happens, you currently need to manually recompile in order to test your changes. A rudimentary build-script is included in the source repository.

Documentation

cli.Cursor()

Docs...

var cursor = new cli.Cursor();
cursor
    .bold()
    .bg.hex('#f00')
    .write('horrible')
    .reset();

Also docs...

var cursor = new cli.Cursor({stream:null});
var prefix = cursor
    .buffer()
    .bold()
    .bg.hex('#f00')
    .write('horrible')
    .reset()
    .flush();
console.log('%s hello', prefix);