How to use the ansi-colors.underline function in ansi-colors

To help you get started, we’ve selected a few ansi-colors 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 sastraxi / pgsh / src / cmd / init.js View on Github external
console.log();

    // bootstrap "db" with our mode / vars and the existing
    // environment (already injected into our process by dotenv.config())
    const initDb = makeDb(mode, vars);

    // figure out where the user wants to switch to and do it
    const { database, config: extraConfig } = await chooseDb(initDb)(initDb.thisDb());
    initDb.switchTo(database);

    createConfig({
      ...extraConfig,
      mode,
      vars,
    });
    console.log(`${c.underline('.pgshrc')} created!`);

    return endProgram(0);
  } catch (err) {
    console.error(
      `pgsh init failed: ${c.redBright(err.message)}`,
    );
    return endProgram(2);
  }
};
github NewFuture / miniprogram-build / src / tasks / devtool.js View on Github external
exports.upload = function () {
    const version = devtool.getPkgVersion() || '0.0.0';
    const dist = path.resolve(exports.dist);
    const uploadProject = version + '@' + dist;
    logStart('upload', 'project in ' + colors.underline(dist));
    const logPath = path.join(os.tmpdir(), 'mplog-' + version + '-' + Date.now() + '.json')

    return devtool.getCommitMsg()
        .then(function (message) {
            message = (message || process.env.npm_package_description || '').trim().substr(0, 2048)
            logger.info(TITLE, colors.gray.bold(version + ':'), colors.dim.gray.underline(message.split('\n', 1)[0]))
            return devtool.cli('--upload', uploadProject, '--upload-info-output', logPath, '--upload-desc', encode(message))
        })
        .then(function (res) {
            if (res.stderr) {
                errLog({ name: 'fail to upload prject ' + uploadProject, message: res.stderr.trim() });
            } else {
                logger.info(
                    TITLE,
                    successIcon,
                    colors.green('成功上传此项目至微信小程序后台!')
github liferay / liferay-js-themes-toolkit / packages / liferay-theme-tasks / lib / upgrade / 6.2 / upgrade.js View on Github external
if (item.fileName && item.fileName !== path.basename(filePath)) {
				return;
			}

			const match = item.negativeMatch
				? !item.regex.test(fileContents)
				: item.regex.test(fileContents);

			if (match) {
				logs.push('    ' + colors.yellow(item.message) + '\n');
			}
		});

		if (logs.length) {
			const fileName = colors.white(
				'File: ' + colors.underline(path.basename(filePath)) + '\n'
			);

			logBuffers.liferay.push(fileName);

			logBuffers.liferay = logBuffers.liferay.concat(logs);
		}
	}
}
github liferay / liferay-js-themes-toolkit / packages / liferay-theme-tasks / lib / upgrade / 7.0 / upgrade.js View on Github external
}

			const match = item.negativeMatch
				? !item.regex.test(fileContents)
				: item.regex.test(fileContents);

			if (match) {
				results.push(item);

				logs.push('    ' + colors.yellow(item.message) + '\n');
			}
		});

		if (logs.length) {
			const fileName = colors.white(
				'File: ' + colors.underline(path.basename(filePath)) + '\n'
			);

			logBuffers[logBuffer].push(fileName);

			logBuffers[logBuffer] = logBuffers[logBuffer].concat(logs);
		}
	}

	return results;
}
github NewFuture / miniprogram-build / src / lib / multi-replace.js View on Github external
function logReplace(n, key, value, file) {
    log.info(
        colors.gray(TITLE),
        colors.gray.bold(colors.symbols.check.repeat(n)),
        colors.gray.dim.italic.strikethrough(key.toString()),
        colors.dim.gray(colors.symbols.pointerSmall),
        typeof value === 'function' ? colors.cyan(colors.italic('Function:') + (value.name || '')) : colors.underline(value),
        colors.gray('(' + colors.underline(
            path.relative(file.base, file.path)
        ) + ')')
    )
}
github enquirer / enquirer / lib / utils / interpolate.js View on Github external
state.values[key] = val;
          value = colors.dim(val);

        } else {
          state.values[key] = '';
          val = `<${token.inner}>`;

          if (state.missing.has(key) || state.invalid.has(key)) {
            value = colors.red(val);
          } else {
            value = colors.cyan(val);
          }
        }

        if (index === state.index) {
          value = colors.underline(value);
        }

        index++;
      }

      if (value) {
        state.output += value;
      }
    }
    return state.output;
  };
};
github NewFuture / miniprogram-build / src / tasks / devtool.js View on Github external
exports.close = function (pass) {
    logStart('close', 'project in ' + colors.underline(exports.dist))
    return exports.isOpenPort().then(function (isOpen) {
        if (!isOpen) {
            logger.warn(TITLE, warnIcon, '跳过关闭项目,请打安装[微信开发者工具]并打开[端口设置]');
        } else if (!fs.existsSync(path.resolve(exports.dist, 'project.config.json'))) {
            logger.warn(TITLE, warnIcon, '跳过关闭项目,', exports.dist + '/project.config.json', '文件不存在');
        } else {
            return devtool.cli('--close', path.resolve(exports.dist))
                .then(function (res) {
                    if (res.stderr) {
                        if (pass) {
                            return Promise.reject(res.stderr);
                        } else {
                            errLog({ name: '微信开发者工具关闭项目出错', message: res.stderr.trim() });
                        }
                    } else {
                        logger.info(TITLE, colors.gray('正在开发工具中关闭此项目... (3秒内勿对其操作)'))
github sastraxi / pgsh / src / cmd / status.js View on Github external
const migrationOutput = async (knex, isPrimary) => {
  const SCHEMA = config.migrations.schema || 'public';
  const TABLE = config.migrations.table || 'knex_migrations';
  try {
    const latest = await knex(`${SCHEMA}.${TABLE}`)
      .orderBy('id', 'desc')
      .first('name', 'migration_time');

    const filename = isPrimary
      ? c.greenBright(c.underline(latest.name))
      : c.underline(latest.name);

    const reltime = c.blueBright(moment(latest.migration_time).fromNow());

    return [filename, reltime];
  } catch (err) {
    return [];
  }
};
github sastraxi / pgsh / src / cmd / list.js View on Github external
const migrationOutput = async (db, knex, isPrimary) => {
  const SCHEMA = config.migrations.schema || 'public';
  const TABLE = config.migrations.table || 'knex_migrations';
  try {
    const latest = await knex(`${SCHEMA}.${TABLE}`)
      .orderBy('id', 'desc')
      .first('name', 'migration_time');

    let filename;
    const fileExists = fs.existsSync(path.join(db.getMigrationsPath(), latest.name));
    if (fileExists) {
      filename = isPrimary
        ? c.greenBright(c.underline(latest.name))
        : c.underline(latest.name);
    } else {
      filename = c.gray(latest.name);
    }

    const reltime = fileExists
      ? c.blueBright(moment(latest.migration_time).fromNow())
      : c.gray(moment(latest.migration_time).fromNow());

    return [filename, reltime];
  } catch (err) {
    return [];
  }
};

ansi-colors

Easily add ANSI colors to your text and symbols in the terminal. A faster drop-in replacement for chalk, kleur and turbocolor (without the dependencies and rendering bugs).

MIT
Latest version published 2 years ago

Package Health Score

74 / 100
Full package analysis