debugging: ( text, code ) => { if( code === 'headline' ) { //this is a fun bit on the top to make our debugging fun if( Custard.DEBUG ) { var fonts = new CFonts({ 'text': text, 'colors': ['white', 'gray'], 'maxLength': 12, }); } } if( code === 'report' ) { if( Custard.DEBUG ) console.log(Chalk.bgWhite("\n" + Chalk.bold.green(' \u2611 ') + Chalk.black(`Custard: ${text} `))); } else if( code === 'error' ) { console.log(Chalk.bgWhite("\n" + Chalk.red(' \u2612 ') + Chalk.black(`Custard: ${text} `))); } else if( code === 'finished' ) { if( Custard.DEBUG ) console.log(Chalk.bgGreen("\n" + Chalk.bold.cyan(' \u219C ') + Chalk.black(`Custard: ${text} `))); } else if( code === 'failsafe' ) { if( Custard.DEBUG ) console.log(Chalk.bgYellow("\n" + Chalk.bold.cyan(' \u2612 ') + Chalk.black(`Custard: ${text} `))); } },
function showHeader() { ui.log('\n' + ' ' + chalk.bgWhite(' ') + '\n' + ' ' + chalk.bgWhite.yellow(' jspm ') + ' ' + chalk.grey('Browser Package Management') + '\n' + ' ' + chalk.bgWhite(' ') + '\n' ); }
Renderer.prototype.blockquote = function(quote) { var splits = quote.trim().split(/\n|\r\n/) var o = splits.map(function(r) { if (!r) return chalk.bgWhite(' ') return util.format('%s %s', chalk.bgWhite(' '), r) }).join('\n') return util.format( '%s\n%s\n%s\n\n' , chalk.bgWhite(' ') , o , chalk.bgWhite(' ') ) }
msg: function(msg) { console.log(chalk.bgWhite(chalk.red('## ') + chalk.black('event-board') + chalk.red(' ## ') + chalk.black(msg))); return this; },
function foundMark(entry, key, str) { if(entry.search === key) { return chalk.bgWhite(str).toString(); } return str; }
msg: function (msg) { console.log(chalk.bgWhite(chalk.red('## ') + chalk.black('Pure Angular Advanced Searchbox') + chalk.red(' ## ') + chalk.black(msg))); return this; },
msg: function (msg) { console.log(chalk.bgWhite(chalk.blue('## ') + chalk.black('Tyler+Beck') + chalk.blue(' ## ') + chalk.black(msg))); return this; },
setTimeout(() => { process.stdout.clearLine(); process.stdout.cursorTo(0); process.stdout.write( `|${chalk.bgWhite(utils.repeat(symbole, i))}${utils.repeat(' ', end - i)}|-${i * step}%` ); if (i === end) { resolve(' '); } }, i * 50);
function buildString (task) { var st = ' '; var duration = ''; // The longest a param can be. var maxLength = 20; var param; if (task.duration) { duration = chalk.bold.magenta(' [' + (task.duration / 1000).toFixed(2) + 's] '); } if (task.it) { st += chalk.black(task.it) + ' '; return chalk.bgWhite(st) + ' ' + chalk.bold.bgWhite(duration); } else { for (var i in task.params) { if (task.params.hasOwnProperty(i)) { param = task.params[i]; if (typeof param === 'object') { param = JSON.stringify(param); } // Cap param string length. if (param.length > maxLength) { param = param.substring(0, maxLength - 4) + '...'; } st += chalk.blue.bold(i) + chalk.bold(' : '); st += chalk.black(param) + ' '; } } return chalk.bold(task.type) + ' ' + chalk.bgWhite(st) + ' ' + chalk.bold.bgWhite(duration); } }
drawLoader: function drawLoader(done, total, action) { // Add time on to the end of the // loader to compensate for building. var doneString = done; var multiple = 0.55; if (action === 'parse') { multiple = 0.60; } else if (action === 'build') { multiple = 0.65; } else if (action === 'write') { multiple = 0.70; } else if (action === 'index') { multiple = 0.75; } else if (action === 'done') { multiple = 0.80; } done = Math.floor(done * multiple); done = done < 0 ? 0 : done; var width = 40; var loader = ''; for (var i = 0; i < width; ++i) { if (i <= done) { loader += chalk.bgGreen(' '); } else { loader += chalk.bgWhite(' '); } } var buildStr = undefined; if (total === 100) { buildStr = 'Preparing...'; } else if (action === 'fetch') { if (doneString === 0) { buildStr = 'Fetching docs...'; } else { buildStr = 'Fetching ' + doneString + ' of ' + total + ' docs...'; } } else if (['parse', 'build'].indexOf(action) > -1) { buildStr = 'Housekeeping...'; } else if (['write', 'index', 'done'].indexOf(action) > -1) { buildStr = 'Feng shui...'; } buildStr = chalk.grey(buildStr); var result = '\n ' + buildStr + '\n\n ' + loader + '\n'; return result; }
module.exports = function (app) { const self = cosmetician; cosmetician.app = app; markterm.cosmetician = cosmetician; markterm.setOptions({ gfm: true, sanitize: true, highlight(code, lang) { let results = code; try { results = highlighter.highlight(code, lang, {}); results = self.tab(results, 2, ' '); results = self.tab(results, 1, chalk.bgWhite(' ')); } catch (e) { console.log(e.stack); } return results; } }); highlighter.theme('default'); return cosmetician; };
prompting: function () { var done = this.async(); this.log(yosay( 'You\'re using the #hackteam\'s fantastic ' + chalk.bgWhite(chalk.magenta('react-prototype')) + ' generator.' )); var prompts = [{ type: 'input', name: 'project', message: 'What is the project\'s name?', default: this.appname }, { type: 'checkbox', name: 'features', message: 'What more would you like?', choices: [{ name: 'Semantic UI', value: 'includeSemantic', checked: true }] }]; this.prompt(prompts, function (answers) { var features = answers.features || []; this.projectName = answers.project; function hasFeature(feat) { return features.indexOf(feat) !== -1; } this.includeSemantic = hasFeature('includeSemantic'); done(); }.bind(this)); },
"use strict"; var borescope = require("../../"); var Progress = require("progress"); var spawn = require("child_process").spawn; var fs = require("fs"); var numeral = require("numeral"); var chalk = require("chalk"); var imageSize = fs.statSync("image.img").size; borescope.size(imageSize); var bar = new Progress(" downloading :bar :eta :percent :throughput", { complete: chalk.bgCyan(" "), incomplete: chalk.bgWhite(" "), width: 10, total: imageSize }); spawn("dd", ["if=image.img"]).stdout .pipe(borescope) .pipe(spawn("dd", ["of=/dev/null"]).stdin); borescope.on("borescopeData", function(data){ bar.tick(data.chunkSize, { throughput: numeral(data.throughput).format("0.00 b") + "/s" }); });
'use strict'; const chalk = require('chalk'); const COMPLETE_CHAR = chalk.bgBlue(' '); const INCOMPLETE_CHAR = chalk.bgWhite(' '); const BAR_WIDTH = 20; function formatTime(millisecs) { let str; const secs = millisecs / 1000; if (secs < 1) str = '< 1 s'; else { const days = secs / (24 * 60 * 60); if (days < 1) str = `${secs | 0} s`; else if (days < 1000) str = `${days | 0} d`; else str = 'a long time'; } return str; } class ProgressBar { constructor(fmt) {
return args.map(function(arg) { return colors.bgWhite(colors.black(" " + arg + " ")) }).join(" ")
if (options.hasOwnProperty('list')) { console.log(chalk.green('Listing devices')); print(device.list()); } // Generate a token if (options.hasOwnProperty('generate-token')) { // Get the _id from either the newly created _device or from an _id or id option var _id = (!!_device && !!_device._id) ? _device._id : options._id || options.id; if (!_id) { console.log(chalk.red('Cannot generate a token, no _id provided.')); console.log(chalk.yellow('To generate tokens, run one of the following commands:')); console.log(chalk.bgWhite(chalk.black('node manage.js --generate-token --_id <_id here>'))); console.log('or'); console.log(chalk.bgWhite(chalk.black('node manage.js --generate-token --id <_id here>'))); console.log('or'); console.log(chalk.bgWhite(chalk.black('node manage.js --generate-token --create'))); } else { console.log(chalk.green('Generating a new token for device: {device}'.replace('{device}', _id))); /** * TODO: Handle non existant _ids */ var _token = auth.signToken({deviceId: _id}); console.log(chalk.green('Token generated:')); console.log('\n'); console.log(chalk.bgMagenta(_token));
var o = splits.map(function(r) { if (!r) return chalk.bgWhite(' ') return util.format('%s %s', chalk.bgWhite(' '), r) }).join('\n')
catch (err){ // Handle errors (hopefully not!) console.log(`${chalk.red('ERROR!')} During tag database loading: ${err}`); process.exit(1); } // Update the listing of snippets in tag_database and log the statistics, along with missing scripts try { for(let snippet of Object.entries(snippets)) if(tagDbData.hasOwnProperty(snippet[0].slice(0,-3)) && tagDbData[snippet[0].slice(0,-3)].trim()) output += `${snippet[0].slice(0,-3)}:${tagDbData[snippet[0].slice(0,-3)].trim()}\n`; else { output += `${snippet[0].slice(0,-3)}:\n`; missingTags++; console.log(`${chalk.yellow('Tag missing:')} ${snippet[0].slice(0,-3)}`); } // Write to tag_database fs.writeFileSync('tag_database', output); } catch (err){ // Handle errors (hopefully not!) console.log(`${chalk.red('ERROR!')} During tag_database generation: ${err}`); process.exit(1); } // Log statistics for the tag_database file console.log(`\n${chalk.bgWhite(chalk.black('=== TAG STATS ==='))}`) for(let tagData of Object.entries(tagDbStats).filter(v => v[0] !== 'undefined')) console.log(`${chalk.green(tagData[0])}: ${tagData[1]} snippets`); console.log(`${chalk.blue('Untagged snippets:')} ${missingTags}\n`); // Log a success message console.log(`${chalk.green('SUCCESS!')} tag_database file updated!`); // Log the time taken console.timeEnd('Tagger');