当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript bold.underline方法代码示例

本文整理汇总了TypeScript中chalk.bold.underline方法的典型用法代码示例。如果您正苦于以下问题:TypeScript bold.underline方法的具体用法?TypeScript bold.underline怎么用?TypeScript bold.underline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chalk.bold的用法示例。


在下文中一共展示了bold.underline方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

renderer.heading = (text, level) => {
    if (level === 1) {
        return '\n' + chalk.bold.underline(text) + '\n\n';
    }

    return chalk.underline(text) + '\n\n';
};
开发者ID:bvkimball,项目名称:linguist,代码行数:7,代码来源:MarkedRenderer.ts

示例2: promptUser

async function promptUser(): Promise<boolean> {
  console.log(chalk.blue(`It appears you have a file or directory at ${join(homedir(), "ledeConfig")}`));
  console.log(chalk.blue("Lede needs to store configuration in this location."));
  console.log(chalk.blue(`It is possible that you already have Lede configuration stored there, in which case, you probably ${chalk.bold.underline("do NOT")} want to overwrite it.`));
  console.log(chalk.blue("Please note, however, if you do not have Lede configurations installed there Lede will not work properly."));
  console.log(chalk.red(`Would you like to overwrite ${join(homedir(), "ledeConfig")}? (y/${chalk.bold.underline("N")})`));

  // Platform dependent line endings silliness
  let r = "\n";
  let n = 1;
  if (platform() === "win32") {
    r = "\r\n";
    n = 2;
  }

  return new Promise((resolve, reject) => {
    process.stdin.resume();
    process.stdin.setEncoding("utf8");
    process.stdin.on("data", (d: string) => {
      if (d.length === n || d.toLowerCase() === `n${r}` || d.toLowerCase() === `no${r}`) return stopAndReturn(false, resolve);
      if (d.toLowerCase() === `y${r}` || d.toLowerCase() === `yes${r}`) return stopAndReturn(true, resolve);
      console.log(chalk.blue(`${d.slice(0, d.length - n)} is not a valid answer to the question.`));
    });
    process.stdin.on("error", () => {
      return stopAndReturn(false, resolve);
    })
  });

  function stopAndReturn(resolveVal: boolean, resolveFn) {
    process.stdin.pause();
    return resolveFn(resolveVal);
  }
}
开发者ID:tbtimes,项目名称:lede-cli,代码行数:33,代码来源:installScript.ts


注:本文中的chalk.bold.underline方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。