const error = (...args) => { if (logType < LOG_TYPES.ERROR) return; console.log(logTime(), process.pid, chalk.bold.red('[ERROR]'), ...args); }
/** * Display Validation Errors */ function flashError(message) { console.emoji('π¦', chalk.bold.red(`β ${message}`)); process.exit(1); }
quote(cli.input[0]) .then(result => { console.log( chalk.cyan(chalk.yellow(result.quote.body) + ' - ' + result.quote.author) ); process.exit(0); }) .catch(err => { console.log(chalk.bold.red(err)); process.exit(1); });
const readNote = (title) => { const notes = loadNotes(); const note = notes.find((note) => note.title === title); if (note) { console.log(chalk.inverse(note.title)); console.log(note.body); } else { console.log(chalk.inverse.red('Note not found!')); } }
function error () { console.error(timestamp(), 'ERROR', chalk.bold.red.apply(chalk, arguments)); }
weather.getWeather(cli.flags) .then(result => { console.log(chalk.red(`${result.city}, ${result.country}`)); console.log(chalk.cyan(`Condition: ${chalk.yellow(result.condition)}`)); console.log(chalk.cyan(`Temperature: ${chalk.yellow(result.temp)}${chalk.yellow('Β°' + result.scale)}`)); if (result.aqi) { console.log(chalk.cyan(`Air Quality: ${chalk.yellow(result.aqi)} ${chalk.yellow(weather.mapAQI(result.aqi))}`)); } process.exit(0); }).catch(err => { if (err) { console.log(chalk.bold.red(err)); process.exit(1); } });
const makeTemplate = (type, name, directory) => { mkdirp(directory); if (type === 'html') { const pathToFile = path.join(directory, `${name}.html`); if (exist(pathToFile)) { console.error(chalk.bold.red('μ΄λ―Έ ν΄λΉ νμΌμ΄ μ‘΄μ¬ν©λλ€')); } else { fs.writeFileSync(pathToFile, htmlTemplate); console.log(chalk.green(pathToFile, 'μμ± μλ£')); } } else if (type === 'express-router') { const pathToFile = path.join(directory, `${name}.js`); if (exist(pathToFile)) { console.error(chalk.bold.red('μ΄λ―Έ ν΄λΉ νμΌμ΄ μ‘΄μ¬ν©λλ€')); } else { fs.writeFileSync(pathToFile, routerTemplate); console.log(chalk.green(pathToFile, 'μμ± μλ£')); } } else { console.error(chalk.bold.red('html λλ express-router λ μ€ νλλ₯Ό μ λ ₯νμΈμ.')); } }
function printTasks(xtasks, options) { const namespaces = xtasks._namespaces; const tasks = xtasks._tasks; namespaces.forEach(n => { const nTasks = tasks[n]; assert(nTasks, `Task namespace ${n} is falsy`); if (Object.keys(nTasks).length === 0) { return; } console.log(chalk.inverse.bold.red(`Namespace '${n}'`)); const taskNames = Object.keys(nTasks).reduce((an, tn) => { let lbl; if (tn.match(/(^\.)|([$~])/)) { lbl = "Hidden"; } else if (tn.match(/^[a-zA-Z_0-9]+$/)) { lbl = "Primary"; } else { lbl = "Other"; } an[lbl] = an[lbl] || []; an[lbl].push(tn); return an; }, {}); const isEmpty = x => !x || x.length === 0; ["Primary", "Other"] .filter(tt => !isEmpty(taskNames[tt])) .forEach(tt => printNSTasks(chalk.bold(`${tt} Tasks`), taskNames[tt], nTasks)); }); }
program .action((cmd, args) => { if (args) { console.log(chalk.bold.red('ν΄λΉ λͺ λ Ήμ΄λ₯Ό μ°Ύμ μ μμ΅λλ€.')); program.help(); } else {
weather.setLocation(cli.flags) .then(result => { console.log(chalk.bold.blue(result)); process.exit(0); }) .catch(err => { if (err) { console.log(chalk.bold.red(err)); process.exit(1); } });
daily_confirmed > 0 ? `\n${chalk.blue(`(+${daily_confirmed})`)}` : '' }`, `${chalk.bold.red(format(deaths).toLocaleString())}${ daily_deaths > 0 ? `\n${chalk.red(`(+${daily_deaths})`)}` : '' }`, chalk.bold.magenta(format(critical).toLocaleString()), const barsConfig = { colors: [asciichart.red, asciichart.blue, asciichart.green], height: 15 }; const trends = trend[`${(country + (state ? state : '')).replace(/\s/g, '').toLowerCase()}`]; if (trends) {
}); } else { (options.verbose) ? console.log(chalk.bold.red('β οΈ INFO:: Serving search results from cache')) : null; return cache.getKey('data');