本文整理汇总了TypeScript中cli-color.red函数的典型用法代码示例。如果您正苦于以下问题:TypeScript red函数的具体用法?TypeScript red怎么用?TypeScript red使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了red函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: aggregateResults
Promise.then(function(results) {
const aggregatedResult = aggregateResults(results);
if (!testEnv) {
if (aggregatedResult.errorCount === 0) {
console.log(
colors.green(
'Successfully generated ' +
aggregatedResult.successCount +
' objects.',
),
);
} else {
console.log(
colors.red(
'Successfully generated ' +
aggregatedResult.successCount +
' objects. Encountered ' +
aggregatedResult.errorCount +
' errors in other files',
),
);
process.exit(1);
}
ParallelProcessQueue.shutDown();
}
}, promise);
示例2: prettyIndexString
/**
* Get a colored, pretty-printed representation of an index.
*/
private prettyIndexString(index: API.Index): string {
let result = "";
if (index.state) {
const stateMsg = `[${index.state}] `;
if (index.state === API.State.READY) {
result += clc.green(stateMsg);
} else if (index.state === API.State.CREATING) {
result += clc.yellow(stateMsg);
} else {
result += clc.red(stateMsg);
}
}
const nameInfo = util.parseIndexName(index.name);
result += clc.cyan(`(${nameInfo.collectionGroupId})`);
result += " -- ";
index.fields.forEach((field) => {
if (field.fieldPath === "__name__") {
return;
}
// Normal field indexes have an "order" while array indexes have an "arrayConfig",
// we want to display whichever one is present.
const orderOrArrayConfig = field.order ? field.order : field.arrayConfig;
result += `(${field.fieldPath},${orderOrArrayConfig}) `;
});
return result;
}
示例3:
cli.on('error', err => {
console.log('');
console.log(clc.red(' ' + err.name + ':', err.message));
err.command.outputUsage();
err.command.outputCommands();
err.command.outputOptions();
console.log();
process.exit(1);
});
示例4: exit
.on('error', (err: Error) => {
if (config.quiet) {
exit(1);
}
if (config.trace) {
throw err;
}
console.log(config.boring ? err.message : clc.red(err.message));
exit(1);
})
示例5: errorDisplayInfo
function errorDisplayInfo(time: Date, info: string): string {
return colors.red('[error][' + time + '] ' + info);
}
示例6: error
error(msg: string) {
this.messages_.push(this.color_ ? clc.red(msg) : msg);
}