ke-cli-alerts
v1.0.1
Published
Cross platform CLI Alerts with colours and colored symbols for success, info, warning and error. It works on Mac OS, GNU/Linux and Windows.
Downloads
2
Maintainers
Readme
ke-cli-alerts
Install
npm install ke-cli-alerts
Usage
const alert = require('ke-cli-alerts');
// Provide the type, msg, options.
alert({type: 'success', msg: 'All done!'});
// Prints: ✔ SUCCESS All done!
alert({type: 'info', msg: 'There is an update available'});
// Prints: ℹ INFO There is an update available
alert({type: 'warning', msg: `You didn't add something!`});
// Prints: ⚠ WARNING You didn't add something!
alert({type: 'error', msg: 'Something went wrong!'});
// Prints: ✖ ERROR Something went wrong!
You can also pass the name
if you want to change the label name:
alert({type: 'success', msg: 'Everything finished!', name: 'DONE'});
// Prints: ✔ DONE Everything finished!
API
alert(options)
➜ options
Type: object
Default: {}
You can specify the options below.
➜ type
Type: string
Default: 'error'
➜ msg
Type: string
Default: 'You forgot to define all options.' // (Error message)
➜ name
Type: string
Default: '' // (Empty string)