How to use the chalk.gray function in chalk

To help you get started, we’ve selected a few chalk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brannondorsey / whonow / index.js View on Github external
function main() {

    const args = parseArgs()
    log.setDefaultLevel('info')

    if (args.logfile) {
        try {
            fs.writeFileSync(args.logfile, 'timestamp,src_ip,question_type,question,answer\n')
            log.info(c.gray('[*]') + ` logging CSV data to ${args.logfile}`)
        } catch (err) {
            log.error(c.red('[!]') + ` error writing to --logfile ${args.logfile}:`)
            log.error(err)
            log.error(c.red('[!]') + ' exiting.')
            process.exit(1)
        }
    }

    const domains = {}
    const orderedDomains = new Set()

    server.on('request', (request, response) => {

        request.question.forEach(question => {

            // only handle A queries for now
github qodesmith / create-new-app / modules / showMongoHelp.js View on Github external
you'll want to ensure 2 main things:

      1. You use a different port than the default port (27017).
      2. You use authentication with a username and password to connect.


    Wherever you are running MongoDB in production you'll want to
    create a new user in the \`admin\` database. SSH into your machine
    and you can add a user from the Mongo console like so:

        ${chalk.bold('// Use the `admin` database.')}
        ${chalk.cyan('use admin')}

        ${chalk.bold('// Create a user with the appropriate roles.')}
        ${chalk.blue('const')} ${chalk.cyan('user')} = {
          ${chalk.cyan('user:')} ${chalk.yellow(`'myUserName'`)}, ${chalk.gray('// Make sure to change this!')}
          ${chalk.cyan('pw:')} ${chalk.yellow(`'myPassword'`)}, ${chalk.gray('// Make sure to change this!')}
          ${chalk.cyan('roles:')} [
            { ${chalk.cyan('role:')} ${chalk.yellow(`'userAdminAnyDatabase'`)}, ${chalk.cyan('db:')} ${chalk.yellow(`'admin'`)} },
            ${chalk.yellow(`'readWriteAnyDatabase'`)}
          ]
        }

        ${chalk.bold('// Save that user to the `admin` database.')}
        ${chalk.cyan('db')}.${chalk.yellow('createUser')}(${chalk.cyan('user')})

    See ${chalk.blue('http://bit.ly/2UTn484')} for more details.


    Mongo-specific variables will be setup in the \`.env\` file.
    If you used the guided process, these variables will contain the
    ${chalk.bold('default values')} and ${chalk.bold('should be changed')} before deploying to production.
github timberio / gitdocs / bin / commands / index.js View on Github external
//    Local dev - same as global
const reactStatic = require.resolve('react-static/bin/react-static')
const reactStaticWorkDir = path.join(__dirname, '../..')

// commands:
// serve (port, version)
// build (version, output)
// init (@config) (create /doc, /docs/public, docs.json, etc)

yargs // eslint-disable-line
  .version()
  .usage('Usage: gitdocs  [options]')
  .command({
    command: 'serve [path]',
    alias: 's',
    desc: chalk.gray('serve'),
    builder: yargs =>
      yargs.options({
        output: {
          alias: 'o',
          default: 'docs-dist',
          desc: chalk.gray('build.output'),
          nargs: 1,
          requiresArg: true,
          type: 'string',
        },
        port: {
          alias: 'P',
          default: 3000,
          desc: chalk.gray('Port to use. Only applies if a path is specified.'),
          nargs: 1,
          requiresArg: true,
github dthree / wat / src / util.js View on Github external
combined = combined.map(function (lines) {
        const lineLength = strip(lines[0]).length;
        for (let i = lines.length; i < longest; ++i) {
          lines.push(self.pad('', lineLength));
        }

        const numRealLines = lines.filter(function (line) {
          return (strip(line).trim() !== '');
        }).length;

        // If we've exceeded the max height and have
        // content, do a fancy `...` and cut the rest
        // of the content.
        if (numRealLines > maxHeight && String(lines[maxHeight - 1]).trim() !== '') {
          let ellip = `${(numRealLines - maxHeight)} more ...`;
          ellip = chalk.gray((ellip.length > lineLength) ? '...' : ellip);
          lines = lines.slice(0, maxHeight - 1);
          lines.push(self.pad(ellip, lineLength));
        }
        return lines;
      });
github ccampbell / luna-testing / src / runner.js View on Github external
if (testData.left.code.indexOf('.') !== -1) {
        const bits = testData.left.code.split('.');
        bits.pop();
        leftIndex += bits.join('.').length + 1;
    }
    let rightIndex = -1;

    if (testData.right) {
        rightIndex = testData.right.range[0];
        if (looksTheSame(testData.right.code, testData.right.value)) {
            rightIndex = -1;
        }
    }

    if (leftIndex > -1) {
        console.log(`${chalk.yellow(formatLine(lineNumber + 1, lineWidth))} ${indent}${spaces(leftIndex)}${chalk.gray('|')}${rightIndex > -1 ? spaces(rightIndex - leftIndex - 1) + chalk.gray('|') : ''}`);
        if (rightIndex > -1) {
            console.log(`${spaces(lineWidth)} ${indent}${spaces(leftIndex)}${chalk.gray('|')}${rightIndex > -1 ? spaces(rightIndex - leftIndex - 1) + syntaxHighlight(JSON.stringify(testData.right.value)) : ''}`);
        }
        console.log(`${spaces(lineWidth)} ${indent}${spaces(leftIndex)}${syntaxHighlight(JSON.stringify(testData.left.value))}\n`);
    }
}
github smspillaz / intuitive-math / internals / scripts / extractIntl.js View on Github external
const logDivider = () => {
  console.log(
    chalk.gray('------------------------------------------------------------------------')
  );
};
github nikersify / jay / source / plugin / help.ts View on Github external
export = (jay: Jay) => {
	console.log(wrapAnsi(chalk.gray(
		'Type',
		`\`${(chalk.blue('> jay.help()'))}\``,
		'in the prompt for more information.'
	), process.stdout.columns || Infinity))

	Object.defineProperty(jay, 'help', {
		value() {
			open(packageJson.homepage)
		}
	})
}
github aws / awsmobile-cli / lib / init-steps / s4-configure.js View on Github external
function validateNewConfig(projectConfig, projectInfo){
    let srcDirPath = path.normalize(path.join(projectInfo.ProjectPath, projectConfig.SourceDir))
    if(!fs.existsSync(srcDirPath)){
        console.log()
        console.log(chalk.bgYellow.bold('Warning:') + 
            ' the projects\'s source directory you specified: ' + 
            chalk.blue(srcDirPath) + ' does not exist.')
        console.log('   awsmobile-cli gathers this information for two reasons: ')
        console.log('   - awsmobile-cli copies the latest ' + chalk.blue(awsmobilejsConstant.AWSExportFileName) + ' file into that folder')
        console.log('     so the backend awsmobile project\'s resources can be easily accessed by your code')
        console.log('   - awsmobile-cli checks the last modification time of the files in the project\'s source directory')
        console.log('     so awsmobile-cli knows if to run the build command before it publishes your application')
        console.log()
        console.log(chalk.gray('    # to change the settings'))
        console.log('    $ awsmobile configure project')
    }
}
github thelounge / thelounge / scripts / changelog.js View on Github external
function extractPackages({title, url}) {
	const extracted = /(?:U|u)pdate(?: dependency)? ([\w-,` ./@]+?) (?:monorepo )?to /.exec(title);

	if (!extracted) {
		log.warn(`Failed to extract package from: ${title}  ${colors.gray(url)}`);
		return [];
	}

	return extracted[1].replace(/`/g, "").split(/, and |, | and /);
}
github derhuerst / multiselect-prompt / index.js View on Github external
, render: function (first) {
		if (first) this.out.write(esc.cursorHide)

		let prompt = [
			  ui.symbol(this.done, this.aborted)
			, chalk.bold(this.msg)
			, this.done ? '' : chalk.gray(this.hint)
		].join(' ')

		if (!this.done) {
			const c = this.cursor
			prompt += '\n' + this.value.map((v, i) =>
				(v.selected ? chalk.green(figures.tick) : ' ') + ' '
				+ (c === i ? chalk.cyan.underline(v.title) : v.title)
			).join('\n')
		}

		this.out.write(ui.clear(this.lastRendered) + prompt)
		this.lastRendered = prompt
	}
}