happycode-gears-terminal
Version: 
Terminal output tools
88 lines (77 loc) • 1.81 kB
Markdown
Terminal (for Gears) is a minimal event subscriber / emitter
```bash
npm install happycode-gears-terminal
```
```js
import {
    info,
    warn,
    log,
    success,
    error,
    welcomeBanner,
    checkbox,
    indent,
    tempLine,
    clearLine,
    emojify,
    keyValue,
    chalk
} from 'happycode-gears-terminal'
```
or
```js
const {
    info,
    warn,
    log,
    success,
    error,
    welcomeBanner,
    checkbox,
    indent,
    tempLine,
    clearLine,
    emojify,
    keyValue,
    chalk
} = require('happycode-gears-terminal')
```
```js
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)
```
[](https://choosealicense.com/licenses/mit/)