How to use the chalk.bgRed 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 advence-liz / json-server-router / cli / index.js View on Github external
.fail(function (msg, err, yargs) {
    if (err) throw err // preserve stack
    console.info(bgRed('You broke it!'))
    console.info(red(msg))
    console.error(green('You should be doing'), yargs.help())
    process.exit(1)
  }).argv
debug(argv)
github netbeast / api / lib / netbeast.js View on Github external
emit: function (msg) {
      // Log notification through console
      var str = chalk.bgCyan('ws') +
      chalk.bold.bgCyan(msg.title || '::')

      switch (msg.emphasis) {
        case 'error':
          str = str + chalk.bgRed(msg.body)
          break
        case 'warning':
          str = str + chalk.bgYellow(msg.body)
          break
        case 'info':
          str = str + chalk.bgBlue(msg.body)
          break
        case 'success':
          str = str + chalk.bgGreen(msg.body)
          break
      }

      var client = mqtt.connect('ws://' + process.env.NETBEAST_URL + ':' + process.env.NETBEAST_PORT)
      console.log(str)
      client.publish('netbeast/push', JSON.stringify(msg))
      client.end()
github sourcegraph / javascript-typescript-langserver / src / logging.ts View on Github external
public error(...values: any[]): void {
        try {
            this.errStream.write(chalk.bgRed('ERROR') + ' ' + format(values) + '\n')
        } catch (err) {
            // ignore
        }
    }
}
github vuejs / vue-cli / packages / @vue / cli / lib / util / log.js View on Github external
exports.error = msg => {
  console.error(format(chalk.bgRed(' ERROR '), chalk.red(msg)))
  if (msg instanceof Error) {
    console.error(msg.stack)
  }
  process.exit(1)
}
github Rhym / node-random-fact / index.js View on Github external
let facts = () => {

  /**
   * Check that the data exists.
   */
  if (!_.isObject(data) && !_.isNil(data)) {
    console.log(chalk.bgRed(`Couldn't load data.`));
    return;
  }

  let uniqueArray = _.uniq(data.facts),
      randomItem  = _.sample(uniqueArray),
      wordLimit   = 7,
      sentences   = _.chunk(_.words(randomItem, /[^, ]+/g), wordLimit),
      text        = '';

  /**
   * Break up the string into sentences.
   */
  _.forEach(sentences, (sentence, index) => {
    text += `${_.join(sentence, ' ')}${sentences.length - 1 == index ? '' : '\n'}`;
  });
github rohan-deshpande / northwest / scripts / dev.js View on Github external
function parseArgs() {
  let settings = {};

  if (argsNum === 2) {
    return settings;
  }

  for (let i = 2; i < argsNum; i++) {
    let arg = args[i].split('=');
    let argKey = arg[0];
    let argValue = arg[1];

    if (allowed.indexOf(argKey) < 0) {
      die(chalk.bgRed(`The argument ${chalk.italic(argKey)} is invalid`));
    }

    switch (argKey) {
      case 'main':
      case 'm':
        settings.main = argValue;
        break;
      case 'css':
      case 'c':
        settings.css = argValue;
        break;
      case 'js':
      case 'j':
        settings.js = argValue;
        break;
      case 'static':
github zerothstack / zeroth / src / common / services / consoleLogger.service.ts View on Github external
public format(logLevel: LogLevel, message: string) {
    switch (logLevel) {
      case 'emergency':
        message = bgRed(message);
        break;
      case 'alert':
        message = red.underline(message);
        break;
      case 'critical':
        message = yellow.underline(message);
        break;
      case 'warning':
        message = yellow(message);
        break;
      case 'notice':
        message = magenta(message);
        break;
      case 'info':
        message = blue(message);
        break;
github danieldelcore / commitpal / bin / index.js View on Github external
.then(choice => {
          const result = step.options.find(
            option => option.description === choice
          );

          return result.value;
        });
    case "text":
      return new Input({
        message: step.message,
        initial: step.initial
      })
        .run()
        .then(choice => choice || "");
    default:
      throw `${chalk.red("Error: option type:")} ${chalk.bgRed(
        step.type
      )} ${chalk.red("not found")}`;
  }
}
github terox / smpp-cli / bin / index.js View on Github external
exec(options.dlrCallback + " '" + dlr.toJson() + "'", function(err, stdout, stderr) {
            if(err) {
              return log(chalk.bgRed('Something went wrong executing the DRL callback'));
            }

            log(chalk.green('Executed callback successfully'));
        });