cli-msg

1.0.0 • Public • Published

cli-msg · GitHub license npm version CircleCI Status

Colored CLI messages for better log messages

Home Image

Install

yarn add cli-msg

npm install cli-msg --save

Naming conventions used

Badge

Badge Image

  • Badge text refers to the text with primary color applied to the background.

Message

Message Image

  • Message text refers to the colored text with the transparent background.

Usage

Message type usage

const { success } = require('cli-msg');
 
// only 1 argument
success('Lorem ipsum dolor sit amet');

One Argument

// 2 or more arguments
// 1st argument is shown in badge text and remaining args shown as one message
success('Lorem', 'ipsum', ' dolor', ' sit', ' amet');

Many Arguments

// Specific message styles
// b - badge style type
// Only badge style text, no message text
success.b('Lorem ipsum dolor sit amet');

b Function

// m - message style type
// Only message style text, no badge text
// All arguments are joined together for the message
success.m('Lorem ipsum dolor', ' sit amet');

m Function

// wb - with default badge - Eg. info will have 'INFO' as the badge text
// message with badge text 'SUCCESS'
success.wb('Lorem ipsum dolor sit amet');

wb Function

Same applies to success, warn, log, error, info message types.

indent

This function is used to position the cursor according to your choice using

  1. nl - newline (/n)
  2. tab - tab (/t)
  3. space - space (' ')

The inner functions are cascaded.

Sample usage
const { indent } = require('cli-msg');
 
warn.b('Lorem ipsum dolor sit amet');
indent
    .nl(2) // New Line
    .tab(3) // Tab Space
    .space(5); // Space
error.b('Lorem ipsum dolor sit amet');

Indent Function

License

MIT

Package Sidebar

Install

npm i cli-msg

Weekly Downloads

27

Version

1.0.0

License

MIT

Unpacked Size

6.7 kB

Total Files

5

Last publish

Collaborators

  • anooprav7