本文整理汇总了TypeScript中chalk.white函数的典型用法代码示例。如果您正苦于以下问题:TypeScript white函数的具体用法?TypeScript white怎么用?TypeScript white使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了white函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
const renderTime = (runTime: number, estimatedTime: number, width: number) => {
// If we are more than one second over the estimated time, highlight it.
const renderedTime =
estimatedTime && runTime >= estimatedTime + 1
? chalk.bold.yellow(runTime + 's')
: runTime + 's';
let time = chalk.bold(`Time:`) + ` ${renderedTime}`;
if (runTime < estimatedTime) {
time += `, estimated ${estimatedTime}s`;
}
// Only show a progress bar if the test run is actually going to take
// some time.
if (estimatedTime > 2 && runTime < estimatedTime && width) {
const availableWidth = Math.min(PROGRESS_BAR_WIDTH, width);
const length = Math.min(
Math.floor((runTime / estimatedTime) * availableWidth),
availableWidth,
);
if (availableWidth >= 2) {
time +=
'\n' +
chalk.green('█').repeat(length) +
chalk.white('█').repeat(availableWidth - length);
}
}
return time;
};
开发者ID:Volune,项目名称:jest,代码行数:28,代码来源:utils.ts
示例2: reportDiagnostic
public static reportDiagnostic( diagnostic: ts.Diagnostic ) {
if ( !diagnostic ) {
return;
}
var output = "";
if ( diagnostic.file ) {
var loc = ts.getLineAndCharacterOfPosition( diagnostic.file, diagnostic.start );
output += chalk.gray( `${ diagnostic.file.fileName }(${ loc.line + 1 },${ loc.character + 1 }): ` );
}
var category;
switch ( diagnostic.category ) {
case ts.DiagnosticCategory.Error:
category = chalk.red( ts.DiagnosticCategory[diagnostic.category].toLowerCase() );
break;
case ts.DiagnosticCategory.Warning:
category = chalk.yellow( ts.DiagnosticCategory[diagnostic.category].toLowerCase() );
break;
default:
category = chalk.green( ts.DiagnosticCategory[diagnostic.category].toLowerCase() );
}
output += `${category} TS${chalk.white( diagnostic.code + '' )}: ${chalk.grey( ts.flattenDiagnosticMessageText( diagnostic.messageText, "\n" ) )}`;
Logger.log( output );
}
开发者ID:danielmoore,项目名称:tsproject,代码行数:30,代码来源:DiagnosticsReporter.ts
示例3: logPeek
public logPeek(path: string, operations: PeekOperation) {
console.log(' ', chalk.white(path))
if (!Object.keys(operations.stats).length) {
console.log(' ', chalk.gray('~~ No changes for this file ~~'))
}
Object.entries(operations.stats).map((stat, index) => {
let actions = Object.entries(stat[1])
if (index > 0) {
actions = actions.filter(
([action]) => !MASTER_ONLY_ACTIONS.includes(action)
)
}
actions.map(([action, name]) => {
console.log(
' ',
chalk.bold(this.formatAction(action)),
':',
chalk.bold.white(name)
)
})
})
console.log('')
}
开发者ID:mirego,项目名称:accent-cli,代码行数:27,代码来源:commit-operation.ts
示例4: run
async function run(helper: Helper, args: {}) {
const cwd = process.cwd();
let rootDir = pkgDir.sync(cwd);
if (!rootDir) {
console.warn(noPackageWarning);
rootDir = cwd;
}
const dojoRcPath = join(rootDir, '.dojorc');
const file = existsSync(dojoRcPath) && readFileSync(dojoRcPath, 'utf8');
let json: { [name: string]: {} } = {};
let indent = '\t';
if (file) {
indent = detectIndent(file).indent || indent;
json = JSON.parse(file);
}
const groupMap = await loadExternalCommands();
const values = [];
for (let [, commandMap] of groupMap.entries()) {
for (let [, value] of commandMap.entries()) {
const name = `${value.group}-${value.name}`;
if (values.indexOf(name) === -1 && json[name] === undefined) {
json[name] = {};
values.push(name);
}
}
}
writeFileSync(dojoRcPath, JSON.stringify(json, null, indent));
console.log(chalk.white(`Successfully wrote .dojorc to ${dojoRcPath}`));
}
开发者ID:dojo,项目名称:cli,代码行数:34,代码来源:init.ts
示例5: log
public log(path: string) {
console.log(' ', chalk.white(path))
console.log(
' ',
chalk.green('✓ Successfully write the locale files from Accent')
)
console.log('')
}
开发者ID:mirego,项目名称:accent-cli,代码行数:8,代码来源:document-export.ts
示例6: printHeader
function printHeader(testName) {
const text = `${++index} of ${testsToRun.length}`;
console.log(green(`Running "${bold(blue(testName))}" (${bold(white(text))})...`));
if (isTravis()) {
console.log(`travis_fold:start:${encode(testName)}`);
}
}
开发者ID:Meligy,项目名称:angular-cli,代码行数:8,代码来源:e2e_runner.ts
示例7: PartnerCenterAuth
.then((token: string) => {
// get the aad token
aadToken = token;
console.log(chalk.green('.. obtained AAD access token.'));
// use aad token to request parter center token
console.log(chalk.white('Obtaining Partner Center token..'));
let pcAuth: PartnerCenterAuth = new PartnerCenterAuth();
return pcAuth.login(aadToken);
})
开发者ID:PartnerCenterSamples,项目名称:partnercenter-restapi-nodejs,代码行数:10,代码来源:index.ts
示例8: PartnerCenterValidator
.then((token: string) => {
// get the partner center token
pcToken = token;
console.log(chalk.green('.. obtained Partner Center access token.'));
// validate a domain availability
let domainToCheck: string = 'wingtiptoys';
console.log(chalk.white('Checking if the domain \'' + domainToCheck + '\' is available...'));
let validator: PartnerCenterValidator = new PartnerCenterValidator(pcToken);
return validator.checkDomain(domainToCheck);
})
开发者ID:PartnerCenterSamples,项目名称:partnercenter-restapi-nodejs,代码行数:11,代码来源:index.ts
示例9: PartnerCenterCustomers
.then((domainAvailable: boolean) => {
if (domainAvailable) {
console.log(chalk.green('.. domain is available.'));
} else {
console.log(chalk.yellow('.. domain is NOT available.'));
}
// use partner center token to get customers
console.log(chalk.white('Getting list of customers...'));
let pcCustomers: PartnerCenterCustomers = new PartnerCenterCustomers(pcToken);
return pcCustomers.get();
})
开发者ID:PartnerCenterSamples,项目名称:partnercenter-restapi-nodejs,代码行数:12,代码来源:index.ts
示例10: printHeader
function printHeader(testName: string, testIndex: number) {
const text = `${testIndex + 1} of ${testsToRun.length}`;
const fullIndex = (testIndex < allSetups.length ? testIndex
: (testIndex - allSetups.length) * nbShards + shardId + allSetups.length) + 1;
const length = tests.length + allSetups.length;
const shard = shardId === null ? ''
: yellow(` [${shardId}:${nbShards}]` + bold(` (${fullIndex}/${length})`));
console.log(green(`Running "${bold(blue(testName))}" (${bold(white(text))}${shard})...`));
if (isTravis()) {
console.log(`travis_fold:start:${encode(testName)}`);
}
}
开发者ID:nickroberts,项目名称:angular-cli,代码行数:13,代码来源:e2e_runner.ts
注:本文中的chalk.white函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论