happycode-gears-terminal
v1.0.14
Published
Terminal output tools
Downloads
4
Maintainers
Readme
Terminal
Terminal (for Gears) is a minimal event subscriber / emitter
Installation
npm install happycode-gears-terminal
Usage
import {
info,
warn,
log,
success,
error,
welcomeBanner,
checkbox,
indent,
tempLine,
clearLine,
emojify,
keyValue,
chalk
} from 'happycode-gears-terminal'
or
const {
info,
warn,
log,
success,
error,
welcomeBanner,
checkbox,
indent,
tempLine,
clearLine,
emojify,
keyValue,
chalk
} = require('happycode-gears-terminal')
welcomeBanner("Terminal", true)
info('This is an "info" line')
warn('This is an "warn" line')
success('This is an "success" line')
error('This is an "error" line')
keyValue('Key', '...and a value')
info(emojify("I :heart: NY!"))
indent(() => checkbox('No way!', false), 4)
indent(() => checkbox('Yes way dude!', true), 8)
indent(() => checkbox('you\'re on Fire dude!', ':fire: '), 4)
log(':fire:')
const tempCheckbox = (message, emojiName) => `${chalk.bold.yellow(`[${emojify(`:${emojiName}:`)}]`)} ${chalk.bold.green(message)}`
tempLine(tempCheckbox('just for a bit', 'strawberry'))
setTimeout(() => {
tempLine(tempCheckbox('just for a while', 'cherries'))
setTimeout(() => {
tempLine(tempCheckbox('not long now', 'hamburger'))
setTimeout(() => {
tempLine(tempCheckbox('nearly there', 'doughnut'))
setTimeout(() => {
tempLine(tempCheckbox('TA DAH!!!', 'lollipop'))
setTimeout(() => {
clearLine()
}, 500)
}, 1000)
}, 1000)
}, 1000)
}, 1000)
// uncomment to clear after 7s
//
// setTimeout(clear, 7000)