1.0.0 • Published 5 years ago
cli-msg v1.0.0
cli-msg ·
Colored CLI messages for better log messages
Install
yarn add cli-msg
npm install cli-msg --save
Naming conventions used
Badge
- Badge text refers to the text with primary color applied to the background.
Message
- 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');
// 2 or more arguments
// 1st argument is shown in badge text and remaining args shown as one message
success('Lorem', 'ipsum', ' dolor', ' sit', ' amet');
// Specific message styles
// b - badge style type
// Only badge style text, no message text
success.b('Lorem ipsum dolor sit amet');
// 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');
// 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');
Same applies to success, warn, log, error, info message types.
indent
This function is used to position the cursor according to your choice using
- nl - newline (/n)
- tab - tab (/t)
- 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');
License
MIT