• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript chalk.underline函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: printCommandHelp

function printCommandHelp(name: string, command: ICommandModule) {
  if (!command) {
    console.log(`Unrecognized command: ${chalk.bold.red.underline(name)}`)
    printHelp()
    return
  }
  console.log(`${chalk.gray('github')} ${command.command}`)
  if (command.aliases) {
    for (const alias of command.aliases) {
      console.log(chalk.gray(`github ${alias}`))
    }
  }
  console.log()
  const [title, body] = command.description.split('\n', 1)
  console.log(chalk.bold(title))
  if (body) {
    console.log(body)
  }
  const { options, args } = command
  if (options) {
    console.log(chalk.underline('\nOptions:'))
    printTable(
      Object.keys(options)
        .map(k => [k, options[k]] as [string, IOption])
        .map(([optionName, option]) => [
          [optionName, ...(option.aliases || [])]
            .map(dasherizeOption)
            .map(x => chalk.bold.blue(x))
            .join(chalk.gray(', ')),
          option.description,
          chalk.gray(`[${chalk.underline(option.type)}]`),
        ])
    )
  }
  if (args && args.length) {
    console.log(chalk.underline('\nArguments:'))
    printTable(
      args.map(arg => [
        (arg.required ? chalk.bold : chalk).blue(arg.name),
        arg.required ? chalk.gray('(required)') : '',
        arg.description,
        chalk.gray(`[${chalk.underline(arg.type)}]`),
      ])
    )
  }
}
开发者ID:Ahskys,项目名称:desktop,代码行数:46,代码来源:help.ts


示例2: createYargs

export function createYargs(): any {
  return yargs
    .version()
    .option("osx", {
      alias: "o",
      describe: "Build for OS X",
      type: "array",
    })
    .option("linux", {
      alias: "l",
      describe: "Build for Linux",
      type: "array",
    })
    .option("win", {
      alias: ["w", "windows"],
      describe: "Build for Windows",
      type: "array",
    })
    .option("x64", {
      describe: "Build for x64",
      type: "boolean",
    })
    .option("ia32", {
      describe: "Build for ia32",
      type: "boolean",
    })
    // .option("target", {
    //   alias: "t",
    //   describe: "Target package types",
    //   choices: commonTargets,
    // })
    .option("publish", {
      alias: "p",
      describe: `Publish artifacts (to GitHub Releases), see ${underline("https://goo.gl/WMlr4n")}`,
      choices: ["onTag", "onTagOrDraft", "always", "never"],
    })
    .option("platform", {
      choices: ["osx", "win", "linux", "darwin", "win32", "all"],
    })
    .option("arch", {
      choices: ["ia32", "x64", "all"],
    })
    .strict()
    .help()
    .epilog(`Project home: ${underline("https://github.com/electron-userland/electron-builder")}`)
}
开发者ID:bright-spark,项目名称:electron-builder,代码行数:46,代码来源:cliOptions.ts


示例3:

 .map(([optionName, option]) => [
   [optionName, ...(option.aliases || [])]
     .map(dasherizeOption)
     .map(x => chalk.bold.blue(x))
     .join(chalk.gray(', ')),
   option.description,
   chalk.gray(`[${chalk.underline(option.type)}]`),
 ])
开发者ID:Ahskys,项目名称:desktop,代码行数:8,代码来源:help.ts


示例4: widthOfString

    results.forEach(function(result) {
        const messages = result.messages;

        if (messages.length === 0) {
            return;
        }

        total += messages.length;
        output += chalk.underline(result.filePath) + "\n";

        output +=
            table(
                messages.map(function(message) {
                    let messageType;
                    // fixable
                    const fixableIcon = message.fix ? chalk[greenColor].bold("\u2713 ") : "";
                    if (message.fix) {
                        totalFixable++;
                    }
                    if ((message as any).fatal || message.severity === 2) {
                        messageType = fixableIcon + chalk.red("error");
                        summaryColor = "red";
                        errors++;
                    } else {
                        messageType = fixableIcon + chalk.yellow("warning");
                        warnings++;
                    }

                    return [
                        "",
                        message.line || 0,
                        message.column || 0,
                        messageType,
                        message.message.replace(/\.$/, ""),
                        chalk.gray(message.ruleId || "")
                    ];
                }),
                {
                    align: ["", "r", "l"],
                    stringLength: function(str: string) {
                        const lines = chalk.stripColor(str).split("\n");
                        return Math.max.apply(
                            null,
                            lines.map(function(line: string) {
                                return widthOfString(line);
                            })
                        );
                    }
                }
            )
                .split("\n")
                .map(function(el: string) {
                    return el.replace(/(\d+)\s+(\d+)/, function(_, p1, p2) {
                        return chalk.gray(p1 + ":" + p2);
                    });
                })
                .join("\n") + "\n\n";
    });
开发者ID:textlint,项目名称:textlint,代码行数:58,代码来源:stylish.ts


示例5: async

export default async () => {
  // check if this folder contains an already bootstrapped project
  // check if config.json exists
  // validate config.json
  // ask if config should be modified
  // walk config tree and ask questions
  console.log('  - now configuring 👩🏿‍🎓');
  if (
    ![
      checkFile('package.json'),
      checkFile('firebase.json'),
      checkFile('firestore.rules'),
      checkFile('firestore.indexes.json'),
      checkFile('storage.rules'),
      checkFile('.firebaserc'),
    ].every(Boolean)
  ) {
    return;
  }

  try {
    const projectId = await getProjectId();

    const { apiKey } = await prompt<{ apiKey: string }>([
      {
        type: 'input',
        name: 'apiKey',
        message: `Visit this page ${chalk.underline(
          `https://console.firebase.google.com/project/${projectId}/settings/general/`
        )} and paste the variable ${chalk.italic('apiKey')} here:`,
      },
    ]);

    let overwriteEnv = true;
    if (checkFile('.env', false)) {
      overwriteEnv = (await prompt<{ overwriteEnv: boolean }>({
        type: 'confirm',
        name: 'overwriteEnv',
        message: 'File .env already exists. Do you want to overwrite it?',
        initial: false,
      })).overwriteEnv;
    }
    if (overwriteEnv) {
      writeEnvFile(projectId, apiKey);
    }

    // TODO: generate config.json
    // TODO: upload cloud functions config
    // TODO: run npm build to generate editor in public folder

    console.log('Please enable Firestore in the Firebase console');
    console.log('Then, run firebase deploy');
  } catch (error) {
    console.log(error);
  }
};
开发者ID:accosine,项目名称:poltergeist,代码行数:56,代码来源:configure.ts


示例6: toString

 public toString(): string {
     var count = "    " + chalk.red(logSymbols.error) + " " +
         this.count + " error" +
         (this.ruleFailures.length > 1 ? "s" : "");
     var output = "\n" + chalk.underline(this.fileName) + "\n" +
             this.generateFailureStrings() +
             "\n\n" + count + "\n\n";
     if (this.options.bell) { output += "\x07"; }
     return output;
 }
开发者ID:adamfitzpatrick,项目名称:tslint-stylish,代码行数:10,代码来源:reporter.ts


示例7: printHelp

function printHelp() {
  console.log(chalk.underline('Commands:'))
  const table: string[][] = []
  for (const commandName of Object.keys(commands)) {
    const command = commands[commandName]
    table.push([chalk.bold(command.command), command.description])
  }
  printTable(table)
  console.log(
    `\nRun ${chalk.bold(
      `github help ${chalk.gray('<command>')}`
    )} for details about each command`
  )
}
开发者ID:Ahskys,项目名称:desktop,代码行数:14,代码来源:help.ts


示例8: widthOfString

    results.forEach(function(result) {
        if (!result.applyingMessages || !result.remainingMessages) {
            return;
        }
        const messages = result.applyingMessages;
        // still error count
        const remainingMessages = result.remainingMessages;
        errors += remainingMessages.length;
        if (messages.length === 0) {
            return;
        }
        output += `${chalk.underline(result.filePath)}\n`;

        output += `${table(
            messages.map(function(message) {
                // fixable
                totalFixed++;
                const messageType = chalk[greenColor].bold("\u2714 ");

                return [
                    "",
                    message.line || 0,
                    message.column || 0,
                    messageType,
                    message.message.replace(/\.$/, ""),
                    chalk.gray(message.ruleId || "")
                ];
            }),
            {
                align: ["", "r", "l"],
                stringLength: (str: string) => {
                    const lines = chalk.stripColor(str).split("\n");
                    return Math.max.apply(
                        null,
                        lines.map(function(line: string) {
                            return widthOfString(line);
                        })
                    );
                }
            }
        )
            .split("\n")
            .map(function(el: string) {
                return el.replace(/(\d+)\s+(\d+)/, function(_m, p1, p2) {
                    return chalk.gray(`${p1}:${p2}`);
                });
            })
            .join("\n")}\n\n`;
    });
开发者ID:textlint,项目名称:textlint,代码行数:49,代码来源:stylish.ts


示例9: clearConsole

  multiCompiler.plugin('done', (stats: Stats) => {
    if (isInteractive) {
      clearConsole()
    }

    // We have switched off the default Webpack output in WebpackDevServer
    // options so we are going to "massage" the warnings and errors and present
    // them in a readable focused way.
    const messages = formatWebpackMessages(stats.toJson())
    const isSuccessful = !messages.errors.length && !messages.warnings.length
    if (isSuccessful) {
      building.succeed(`Compiled successfully!`)
    }

    // If errors exist, only show errors.
    if (messages.errors.length) {
      // Only keep the first error. Others are often indicative
      // of the same problem, but confuse the reader with noise.
      if (messages.errors.length > 1) {
        messages.errors.length = 1
      }
      building.fail(`Failed to compile`)
      // tslint:disable-next-line:no-console
      console.log(messages.errors.join('\n\n'))
      return
    }

    // Show warnings if no errors were found.
    if (messages.warnings.length) {
      building.warn('Compiled with warnings')
      // tslint:disable-next-line:no-console
      console.log(messages.warnings.join('\n\n'))

      // Teach some ESLint tricks.
      // tslint:disable-next-line:no-console
      console.log(
        '\nSearch for the ' +
          chalk.underline(chalk.yellow('keywords')) +
          ' to learn more about each warning.'
      )
      // tslint:disable-next-line:no-console
      console.log(
        'To ignore, add ' +
          chalk.cyan('// eslint-disable-next-line') +
          ' to the line before.\n'
      )
    }
  })
开发者ID:aranja,项目名称:tux,代码行数:48,代码来源:start.ts


示例10:

export const result = (
  label: string = 'TOTAL',
  prettySizeBefore: string,
  prettySizeAfter: string,
  prettySizeSaving: string,
  sizeSavingPercent: number,
  qualityPercent: number
) => {
  console.log(
    '%s %s was: %s now: %s saving: %s (%s)',
    color.green('✓'),
    chalk.underline(label),
    color.red(prettySizeBefore),
    color.green(prettySizeAfter),
    color.green(prettySizeSaving),
    color.green(`${sizeSavingPercent.toFixed(2)}%`)
  );
};
开发者ID:JamieMason,项目名称:ImageOptim-CLI,代码行数:18,代码来源:log.ts



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript chalk.white函数代码示例发布时间:2022-05-25
下一篇:
TypeScript chalk.stripColor函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap