files.forEach(file => { const { path, content } = file process.stdout.write('\b'.repeat(10000)) process.stdout.write(chalk.grey(`INFO: check ${path}`)) const valid = prettier.check(content, { filepath: path }) file.check = valid if (!valid && !program.lint) { print(chalk.red(`ERROR: ${path} lint check fails`)) process.exit(1) } })
files.forEach(file => { const { content, check, path } = file if (check) { print(chalk.grey(`INFO: lint ${path}`)) return } print(`INFO: lint ${path}`) const validContent = prettier.format(content, { filepath: path }) fs.writeFileSync(path, validContent, { flag: 'w' }) })
function generateFile (file, opts) { // ensure that the file (and its folder) exists ensureFileSync(file.absoluteName) return new Promise(resolve => { // use the appropriate generator to handle the file creation generators[file.generator](file, opts, () => { const size = `(${getFileSize(file.absoluteName)})` const type = (file.generator + ':').padEnd(13, ' ') log(`Generated ${type} ${green(file.relativeName)} ${grey(size)}`) resolve() }) }) }
positionals.forEach(function(pos) { var posStr = pos.string || pos.name; str += posStr + spaces(longest - posStr.length) + " "; if (!this._nocolors) { str += chalk.grey(pos.help || "") } else { str += (pos.help || "") } str += "\n"; }, this);
async run (argv) { const { config } = parseArgs(argv) // Delay loading framework until command is actually run const { Bak } = require('../../..') // Create server instance const bak = new Bak(config) // Start server await bak.init() const { uri } = bak.server.hapi.info consola.ready({ message: `Listening on ${chalk.blue.underline(uri.replace('0.0.0.0', 'localhost'))}` + (uri.includes('0.0.0.0') ? (chalk.grey(' (all interfaces)')) : ''), badge: true }) }
lines.map( ( line, i ) => { // default line number let lineNumber = `${ i + 1 } : `; // if line number is less than 100, add left padding spaces for alignment if( ( i + 1 ) < 10 ) { lineNumber = ` ${ lineNumber }`; // 2 spaces padding } else if( ( i + 1 ) < 100 ) { lineNumber = ` ${ lineNumber }`; // 1 space padding } // prepend line number to the `line` string return chalk.grey( lineNumber ) + line; } ).join( '\n' )
prompt.ask(answer => { if (answer) { const spinner = ora("Restoring backup...").start(); restore(db, collections, backupFile) .then(() => { spinner.stop(); console.log(chalk.green("Backup has been restored!")); }) .catch(err => { spinner.stop(); console.error(err); }); } else { console.log(chalk.grey(`Restoring backup is cancelled.`)); } });
toString(verbose) { let output = this.toStringBasics(); if (this.options.killed) { // Process was killed output += chalk.yellow( 'Process was killed, meaning your system ran out of memory.\n' + 'You should either increase the amount of RAM in your system, or add swap space.\n\n' ); } else if (this.options.code) { output += chalk.yellow(`Exit code: ${this.options.code}\n\n`); } if (verbose) { if (this.options.stdout) { output += chalk.grey('--------------- stdout ---------------\n') + `${this.options.stdout}\n\n`; } if (this.options.stderr) { output += chalk.grey('--------------- stderr ---------------\n') + `${this.options.stderr}\n`; } } return output; }
options.forEach(function(opt) { if (!opt.hidden) { str += " " + opt.string + spaces(longest - opt.string.length) + " "; var defaults = (opt.default != null ? " [" + opt.default + "]" : ""); var help = opt.help ? opt.help + defaults : ""; str += this._nocolors ? help: chalk.grey(help); str += "\n"; } }, this);
log(chalk.grey("CURRENT 1ST ASK PRICE : " + buyPrice[pair])) var precision = stepSize[pair].toString().split('.')[1].length || 0 quantity[pair] = (( ((total[pair] / buyPrice[pair]) / parseFloat(stepSize[pair])) | 0 ) * parseFloat(stepSize[pair])).toFixed(precision) log(chalk.grey("BUYING " + quantity[pair] + " OF " + pair + " AT MARKET PRICE" )) balance[pair] = quantity[pair] log(logSymbols.success, chalk.grey("BUY MARKET ORDER SET")) check_market_order(pair, order.orderId) })
return console.log('') return console.log(chalk.grey.bold(toLength(row || '', maxLengths, 'l')))
positionals.forEach(function(pos) { var posStr = pos.string || pos.name; str += posStr + spaces(longest - posStr.length) + " "; if (!this._nocolors) { str += chalk.grey(pos.help || "") } else { str += (pos.help || "") } str += "\n"; }, this);
options.forEach(function(opt) { if (!opt.hidden) { str += " " + opt.string + spaces(longest - opt.string.length) + " "; var defaults = (opt.default != null ? " [" + opt.default + "]" : ""); var help = opt.help ? opt.help + defaults : ""; str += this._nocolors ? help: chalk.grey(help); str += "\n"; } }, this);
async run (argv) { const { config } = parseArgs(argv) // Delay loading framework until command is actually run const { Bak } = require('../../..') // Create server instance const bak = new Bak(config) // Start server await bak.init() const { uri } = bak.server.hapi.info consola.ready({ message: `Listening on ${chalk.blue.underline(uri.replace('0.0.0.0', 'localhost'))}` + (uri.includes('0.0.0.0') ? (chalk.grey(' (all interfaces)')) : ''), badge: true }) }