Git Product home page Git Product logo

cli-msg's Introduction

cli-msg · GitHub license npm version CircleCI Status issues

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

MIT

cli-msg's People

Contributors

anooprav7 avatar

Stargazers

Ben avatar

Watchers

James Cloos avatar  avatar

Forkers

rivy

cli-msg's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.