Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 32x 26x 26x 26x 26x 26x 26x 26x 26x 32x 5x 5x 5x 32x 32x 3x 3x 3x 32x 32x 32x 39x 39x 39x 32x 68x 68x 68x 32x 32x 11x 11x 11x 11x 11x 11x 11x 32x 1x 1x 1x 1x 1x 1x 1x 32x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | 'use strict'
const util = require('util')
const chalk = require('chalk')
const debug = require('debug')('ncm')
const COLORS = {
light1: 'hex(\'#89a19d\')',
base: 'hex(\'#4c5859\')',
blue: 'hex(\'#4cb5ff\')',
teal: 'hex(\'#66ccbb\')',
green: 'hex(\'#5ac878\')',
yellow: 'hex(\'#ffb726\')',
orange: 'hex(\'#ff8b40\')',
red: 'hex(\'#ff6040\')'
}
module.exports = {
COLORS,
// formatted printers
header,
line,
failure,
success,
action,
prompt,
tooltip,
divider,
box,
boxbox,
rawBox,
formatError
}
// Formatted printers
function header (text) {
const { length } = text
return chalk`
{${COLORS.light1} ╔══${'═'.repeat(length)}╗}
{${COLORS.light1} ║} {white ${text}} {${COLORS.light1} ║}
{${COLORS.light1} ╚══${'═'.repeat(length)}╝}
`.trim()
}
function line (symbol, text, color = COLORS.light1) {
return chalk`{${color} ${symbol}} ${text}`
}
function failure (text) {
return line('X', text, COLORS.red)
}
function success (text) {
return line('✓', text, COLORS.green)
}
function action (text) {
return line('|➔', text, COLORS.yellow)
}
function prompt (text) {
return line('?', text, COLORS.red)
}
function tooltip (text) {
return chalk`{${COLORS.teal} |➔ ${text}}`
}
function divider (length, char = '-') {
return chalk`{${COLORS.light1} ${char.repeat(length)}}`
}
function box (symbol, text, color = COLORS.light1) {
const length = symbol.length + text.length
return chalk`
{${color} ┌──${'─'.repeat(length)}─┐}
{${color} │ ${symbol}} {white ${text}} {${color} │}
{${color} └──${'─'.repeat(length)}─┘}
`.trim()
}
function boxbox (symbol, text, color = COLORS.light1, symbolLength) {
return chalk`
{${color} ┌─${'─'.repeat(symbolLength || symbol.length)}─┬─${'─'.repeat(text.length)}─┐}
{${color} │ ${symbol} │} {white ${text}} {${color} │}
{${color} └─${'─'.repeat(symbolLength || symbol.length)}─┴─${'─'.repeat(text.length)}─┘}
`.trim()
}
function rawBox (text, length, color = COLORS.light1) {
return chalk`
{${color} ┌─${'─'.repeat(length)}─┐}
{${color} │} ${text} {${color} │}
{${color} └─${'─'.repeat(length)}─┘}
`.trim()
}
function formatError (message, err) {
let errMsg
if (err) {
if (err.code) {
errMsg = util.format(message, err.code, err)
} else {
errMsg = util.format(message, err)
}
}
if (errMsg) {
if (process.env.NCM_DEV === 'true') message = errMsg
debug(errMsg)
}
return line('‼︎', chalk`{${COLORS.red} ${message}}`, COLORS.red)
}
|