CLI Alerts with customizable design for
success
,info
,warning
,error
, andcustom
alerts. Based on Ahmad Awais course.
npm tt-cli-alerts
provide message into the desired type of alert:
const alert = require('tt-cli-alerts')
alert.success('This is a success message')
// ✔ SUCCESS This is a success message
alert.error('This is an error message')
// ✖ ERROR This is an error message
alert.warning('This is a warning message')
// ⚠ WARNING This is a warning message
alert.info('This is an information message')
// ℹ INFO This is an information message
create your own alerts with the alertFactory
:
const { alertFactory } = require('tt-cli-alerts')
// creating only alert name
const foo = alertFactory('foo')
foo('lorem ipsum dolor sit amet')
// creating alert name + color
const bar = alertFactory('bar', '#deaa00')
bar('lorem ipsum dolor sit amet')
// creating alert name + color + icon
const baz = alertFactory('baz', '#00a9bc', '🤟')
baz('lorem ipsum dolor sit amet')
customize existing or your custom alerts.
const { warning } = require('tt-cli-alerts')
warning('lorem ipsum dolor sit amet')
warning('lorem ipsum dolor sit amet', {
icon: '🔥',
title: 'waaarning',
color: '#ffa500',
transparent: true,
})
type: string
default: '★'
type: string
default: alertFactory given name
type: string
default: #fff
(HEX number)
type: bool
default: false
type: string
default: Message cannot be empty
(Error message)