How to use the chalk.redBright 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 netlify / cli / src / commands / sites / delete.js View on Github external
this.log()
      const { wantsToDelete } = await inquirer.prompt({
        type: 'confirm',
        name: 'wantsToDelete',
        message: `WARNING: Are you sure you want to delete the "${siteData.name}" site?`,
        default: false
      })
      this.log()
      if (!wantsToDelete) {
        this.exit()
      }
    }

    /* Validation logic if siteId passed in does not match current site ID */
    if (noForce && (cwdSiteId && cwdSiteId !== siteId)) {
      this.log(`${chalk.redBright('Warning')}: The siteId supplied does not match the current working directory siteId`)
      this.log()
      this.log(`Supplied:       "${siteId}"`)
      this.log(`Current Site:   "${cwdSiteId}"`)
      this.log()
      this.log(`Verify this siteID "${cwdSiteId}" supplied is correct and proceed.`)
      this.log('To skip this prompt, pass a --force flag to the delete command')
      const { wantsToDelete } = await inquirer.prompt({
        type: 'confirm',
        name: 'wantsToDelete',
        message: `Verify & Proceed with deletion of site "${siteId}"?`,
        default: false
      })
      if (!wantsToDelete) {
        this.exit()
      }
    }
github prisma / photonjs / packages / photon-generate / src / runtime / utils / printJsonErrors.ts View on Github external
.split('\n')
            .map((line, index, arr) => (index === arr.length - 1 ? line + DIM_TOKEN : line))
            .join('\n')
        }
        if (isOnMissingItemPath && typeof value === 'string') {
          valueStr = valueStr.slice(1, valueStr.length - 1)
          if (!isOptional) {
            valueStr = chalk.bold(valueStr)
          }
        }
        if ((typeof value !== 'object' || value === null) && !valueError && !isOnMissingItemPath) {
          valueStr = chalk.dim(valueStr)
        }

        const keyStr = keyError ? chalk.redBright(key) : key
        valueStr = valueError ? chalk.redBright(valueStr) : valueStr
        // valueStr can be multiple lines if it's an object
        let output = indent + keyStr + ': ' + valueStr + (isOnMissingItemPath ? eol : chalk.dim(eol))

        // if there is an error, add the scribble lines
        // 3 options:
        // error in key, but not in value
        // error in value, but not in key
        // error in both
        if (keyError || valueError) {
          const lines = output.split('\n')
          const keyLength = String(key).length
          const keyScribbles = keyError ? chalk.redBright('~'.repeat(keyLength)) : ' '.repeat(keyLength)

          const valueLength = valueError ? getValueLength(indent, key, value, stringifiedValue) : 0
          const hideValueScribbles = Boolean(valueError && (typeof value === 'object' && value !== null))
          const valueScribbles = valueError ? '  ' + chalk.redBright('~'.repeat(valueLength)) : ''
github msrivastav13 / mo-dx-plugin / src / commands / retrieve / dxsource.ts View on Github external
);
        } catch (error) {
          console.error(chalk.redBright(error));
        }
      }
      // DX Conversion
      try {
        await exec(
          `sfdx force:mdapi:convert -r ./${tmpDir} -d ${target} --json`
        );
        this.ux.stopSpinner(
          chalk.greenBright('Done Converting mdapi to DX format ✔')
        );
      } catch (err) {
        this.ux.errorJson(err);
        this.ux.error(chalk.redBright('Error from conversion ✖'));
      }
      if (!this.flags.retainmetadata) {
        this.ux.startSpinner(
          chalk.blueBright('Cleaning Unused Directory Started ✔')
        );
        if (process.platform.includes('darwin')) {
          await exec(`rm -rf ./${tmpDir}`);
        } else {
          fs.removeSync(`./${tmpDir}`);
        }
      }
      this.ux.stopSpinner(chalk.greenBright('Finished ✔'));
    }

    return '';
  }
github prisma / photonjs / packages / photon / src / runtime / query.ts View on Github external
protected printFieldError = ({ error, path }: FieldError) => {
    if (error.type === 'emptySelect') {
      return `The ${chalk.redBright('`select`')} statement for type ${chalk.bold(
        getOutputTypeName(error.field.outputType.type),
      )} must not be empty. Available options are listed in ${chalk.greenBright.dim('green')}.`
    }
    if (error.type === 'emptyInclude') {
      return `The ${chalk.redBright('`include`')} statement for type ${chalk.bold(
        getOutputTypeName(error.field.outputType.type),
      )} must not be empty. Available options are listed in ${chalk.greenBright.dim('green')}.`
    }
    if (error.type === 'noTrueSelect') {
      return `The ${chalk.redBright('`select`')} statement for type ${chalk.bold(
        getOutputTypeName(error.field.outputType.type),
      )} needs ${chalk.bold('at least one truthy value')}. Available options are listed in ${chalk.greenBright.dim(
        'green',
      )}.`
    }
    if (error.type === 'includeAndSelect') {
      // return `The ${chalk.redBright('`select`')} statement for type ${chalk.bold(
      //   getOutputTypeName(error.field.outputType.type),
      // )} needs ${chalk.bold('at least one truthy value')}. Available options are listed in ${chalk.greenBright.dim(
      //   'green',
      // )}.`
github Knutakir / btc-value-cli / cli.js View on Github external
function exitError(error) {
    spinner.stop();
    console.log(chalk.redBright(`${logSymbols.error} ${error}`));
    process.exit(1);
}
github hankchanocd / npm-fzf / src / npmRegistry.js View on Github external
function defaultNodeFzf(module = "") {
	console.log(`The default node-fzf doesn't have preview option`);

	if (!module) {
		return console.log(chalk.redBright(`Please provide a module`));
	}

	return npmRegistry(module)
		.then(i => i.simple().raw())
		.then(i => nfzf(i))
		.then(i => {
			const { selected, query } = i;
			if (!selected) {
				console.log("No matches for:", query);
			} else {
				console.log(selected.value);
			}
			return;
		})
		.catch(err => console.log(chalk.redBright(err)));
}
github ChatPlug / ChatPlug / src / configWizard / cli / CLICommands.ts View on Github external
public async services(
    @CLIArgument({
      name: CLIArguments.SERVICE,
      descriptionOverride: DescriptionFlags.IGNORE,
    })
    _: boolean,
  ) {
    const serviceRepository = this.connection.getRepository(Service)

    const services = await this.context.serviceManager.getAvailableServices()
    for (const service of services) {
      console.log('')
      console.log('Service ' + chalk.redBright(service.moduleName))
      console.log(
        chalk.green(service.displayName) +
          chalk.greenBright(' v' + service.version),
      )
      console.log(chalk.blue(service.description))
      const serviceInstances = await serviceRepository.find({
        moduleName: service.moduleName,
      })
      if (serviceInstances.length > 0) {
        console.log(
          'instances: ' +
            serviceInstances
              .map(el => {
                return el.enabled
                  ? chalk.green(el.instanceName)
                  : chalk.red(el.instanceName)
github IanMitchell / aquarius / src / lib / managers / emojis.js View on Github external
getList() {
    log('Refreshing emoji list');

    const homeGuild = aquarius.guilds.get(aquarius.config.home.guild);

    if (!homeGuild) {
      log(
        chalk.redBright(
          'ERROR: Aquarius is not a member of the Home Server defined in `config.yml`'
        )
      );
      return;
    }

    homeGuild.emojis
      .filter(emoji => emoji.name.startsWith('aquarius'))
      .array()
      .forEach(emoji => this.set(emoji.name.replace(/aquarius_/, ''), emoji));
  }
}