本文整理汇总了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';
};
示例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);
}
}