formatContainerState (state) { let stateFormatted = figures.square if (state === 'restarting') { return chalk.blue(stateFormatted) } if (state === 'running') { return chalk.green(stateFormatted) } if (state === 'paused') { return chalk.yellow(stateFormatted) } if (state === 'exited') { return chalk.gray(stateFormatted) } if (state === 'dead') { return chalk.red(stateFormatted) } return stateFormatted }
console.log(chalk.blue('Bumping version in package.json and commiting.')); versiony.version(newVersion).to('./package.json'); shell.exec(`git add package.json`); console.log(chalk.green('Commited new version succesfully.\n')); console.log(chalk.blue('Starting a new build. This may take a while. Coffee?')); shell.exec(`git push origin v${newVersion}`); console.log(chalk.blue(`\n ${newVersion} released successfully 🎉`)); })();
_parseLifemojis(lifemojis) { return lifemojis.map(lifemoji => { return console.log( `${lifemoji.emoji} - ${chalk.blue(lifemoji.code)} - ${ lifemoji.description }` ); }); }
log() { if (this._getCommitsPath().exist === false) { return this._errorMessage('Please initialize your life first.'); } return this._fetchCommits() .then(commits => { commits.sort((c1, c2) => { if (new Date(c1.date).getTime() < new Date(c2.date).getTime()) return 1; else return -1; }); commits.forEach(commit => { const date = new Date(commit.date).toString('yyyy/M/d'); console.log( `* ${chalk.red(commit.id.slice(0, 6))} - ${ commit.lifemoji } ${chalk.blue(commit.title)} ${chalk.green(date)}` ); }); }) .catch(error => { return this._errorMessage(error); }); }
fastify.listen(config.api.port, config.api.host, (err, address) => { if (err) { reject(err); } console.log('\n'); console.log(`${chalk.blue('API Started at:')} ${address}`); resolve(); });
through((chunk, _, callback) => { try { let { id, level, name, message } = JSON.parse(chunk) const color = levels[level] id = id ? ` ${chalk.blue(id)} ` : ' ' message = typeof message === 'object' ? JSON.stringify(message, null, 2) : message console.log(`${color(level)}${id}(${chalk.cyan(name)}) ${message}`) callback(null, chunk) } catch (err) { callback(err) } })
async [_convertFiles](converter, filePaths, options) { const format = this[_provider].getFormat(); for (const inputFilePath of filePaths) { const outputFilePath = await converter.convertFile(inputFilePath, options); this.output(`Converted SVG file to ${format} file: ` + `${chalk.blue(inputFilePath)} -> ${chalk.blue(outputFilePath)}`); } this.output(chalk.green('Done!')); }
yarg.command('localaddresses', 'returns ip addresses and mac addresses of all local devices connected to your network', (yargs) => { console.log(chalk.green('Searching...')) }, function (argv) { find().then(devices => { // console.log(devices); for (let i = 0; i < devices.length; i++) { let device = devices[i]; let name = device.name.split('.'); console.log(`${name[0]} ${chalk.green(device.ip)} ${chalk.blue(device.mac)}`) } }) });
end() { const { projectNameKebab } = this; try { this.log(chalk.blue('Committing the changes with git...\n')); execSync(`cd ${projectNameKebab}; git add .; git commit -m 'generated oxy-gen app'`); } catch(err) { this.log(chalk.red(err)); return; } }
var execNext = function(){ let cmd = cmds.shift(); console.log(chalk.blue('run command: ') + chalk.magenta(cmd)); shell.exec(cmd, function(err){ if (err) { cb(err); } else { if (cmds.length) execNext(); else cb(null); } }); }
/** * Feedback to user * @param {string} info * @returns {Function} */ function feedbackToUser(info) { return result => { console.info(chalk.blue(info)); return result; }; }
figlet('KickThemOut', function (err, logo) { if (err) { console.log('Something went wrong...') console.dir(err) return } var credits = chalk.yellow(' === Kick Devices off your LAN (' + chalk.red('KickThemOut v' + pkg.version) + ') ===\n') + chalk.yellow(' === Made with', chalk.red('\u2764'), 'by', chalk.blue('Rocco Musolino'), '(roccomuso) ===') cb(null, chalk.magenta(logo) + '\n' + credits + '\n\n') // then print logo con console })
generateInits(projectName) { try { const initPath = `${__dirname}/init/AWS`; this.createDirectoryContents(initPath, projectName); console.log(chalk.blue(`Finished initializing ${projectName}`)); commands.changeDir(projectName); } catch (err) { throw new Error(`Could not create init files for this project.\nError: ${err}`); } }
fs.rename(name, newname, (err) => { if (err) console.log(`ERROR: ${err}`); else { console.log(chalk.blue('file was renamed.')); } });