https://github.com/anooprav7/cli-msg
Colorful Terminal log messages (multiple message types)
https://github.com/anooprav7/cli-msg
cli color command-line console javascript terminal-emulators themed-cli
Last synced: 2 months ago
JSON representation
Colorful Terminal log messages (multiple message types)
- Host: GitHub
- URL: https://github.com/anooprav7/cli-msg
- Owner: anooprav7
- License: mit
- Created: 2019-04-13T09:13:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-01-03T19:41:00.000Z (over 2 years ago)
- Last Synced: 2025-03-18T14:54:47.999Z (3 months ago)
- Topics: cli, color, command-line, console, javascript, terminal-emulators, themed-cli
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/cli-msg
- Size: 1.23 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# cli-msg · [](https://github.com/anooprav7/cli-msg/blob/master/LICENSE) [](https://www.npmjs.com/package/cli-msg) [](https://circleci.com/gh/anooprav7/cli-msg) [](https://www.github.com/anooprav7/cli-msg/issues)
> Colored CLI messages for better log messages

## Install
```
yarn add cli-msgnpm 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
```js
const { success } = require('cli-msg');// only 1 argument
success('Lorem ipsum dolor sit amet');
```
```js
// 2 or more arguments
// 1st argument is shown in badge text and remaining args shown as one message
success('Lorem', 'ipsum', ' dolor', ' sit', ' amet');
```
```js
// Specific message styles
// b - badge style type
// Only badge style text, no message text
success.b('Lorem ipsum dolor sit amet');
```
```js
// 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');
```
```js
// 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
1. nl - newline (/n)
2. tab - tab (/t)
3. space - space (' ')The inner functions are cascaded.
##### Sample usage
```js
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](LICENSE)
MIT