本文整理汇总了TypeScript中cli-color.yellow函数的典型用法代码示例。如果您正苦于以下问题:TypeScript yellow函数的具体用法?TypeScript yellow怎么用?TypeScript yellow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了yellow函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: startEmulator
export async function startEmulator(instance: EmulatorInstance): Promise<void> {
const name = instance.getName();
const info = instance.getInfo();
// Log the command for analytics
track("emulators:start", name);
// TODO(samstern): This check should only occur when the host is localhost
const portOpen = await checkPortOpen(info.port);
if (!portOpen) {
await cleanShutdown();
utils.logWarning(`Port ${info.port} is not open, could not start ${name} emulator.`);
utils.logBullet(`To select a different port for the emulator, update your "firebase.json":
{
// ...
"emulators": {
"${name}": {
"port": "${clc.yellow("PORT")}"
}
}
}`);
return utils.reject(`Could not start ${name} emulator, port taken.`, {});
}
// Start the emulator, wait for it to grab its port, and then mark it as started
// in the registry.
await EmulatorRegistry.start(instance);
await waitForPortClosed(info.port);
}
示例2: writeFiles
private writeFiles(matches: Array<string>) {
console.info(clc.yellow('Generating files:'));
matches.forEach((match: string) => {
let cleanedMatch = this.cleanModule(match);
let fullFilePath = path.join(process.cwd(), this.config.proxyjs.outDir, `${match}.js`);
// Make sure that all folders are created.
mkdirp.sync(path.dirname(fullFilePath));
// Get `require` relative path.
let requireFileFullPath = path.join(process.cwd(), this.config.proxyjs.requireFile);
let requireFileRelativePath = this.getRelativePath(fullFilePath, requireFileFullPath);
console.log(fullFilePath);
//Write to file
let stream = fs.createWriteStream(fullFilePath, { 'flags': 'w' });
let moduleName = Helpers.kebabCaseToPascalCase(cleanedMatch);
stream.write(
[
HEADER_COMMENT,
this.generateLine(requireFileRelativePath, moduleName)
].join('\r\n'));
stream.end();
});
console.info(clc.green('Done generating files.'));
}
示例3: prettyFieldString
/**
* Get a colored, pretty-printed representation of a field
*/
private prettyFieldString(field: API.Field): string {
let result = "";
const parsedName = util.parseFieldName(field.name);
result +=
"[" +
clc.cyan(parsedName.collectionGroupId) +
"." +
clc.yellow(parsedName.fieldPath) +
"] --";
const fieldIndexes = field.indexConfig.indexes || [];
if (fieldIndexes.length > 0) {
fieldIndexes.forEach((index) => {
const firstField = index.fields[0];
const mode = firstField.order || firstField.arrayConfig;
result += ` (${mode})`;
});
} else {
result += " (no indexes)";
}
return result;
}
示例4: 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;
}
示例5: showHand
public static showHand(game: goita.Game, turn: number, hidden: boolean) {
const player = game.board.players[turn];
const p = "p" + (player.no + 1);
console.write(p + " hand: ");
if (hidden) {
const len = player.hand.length;
let str = "";
for (const h of player.hand.sort()) {
if (h.value !== goita.Define.empty) {
str += "â";
}
}
console.write(clc.yellow(str));
} else {
console.write(clc.yellow(goita.KomaArray.toTextString(player.hand.sort())));
}
console.write("\n");
console.write("------------------------\n");
}
示例6: zrfPrettyPrint
export function zrfPrettyPrint(V, indent = 0) {
var clc = require("cli-color"), s = "", t = "";
for (var i = 0; i < indent + 1; i++) {
t += " ";
}
if (typeof V !== "object") {
return (V != null ? V.toString() : clc.yellow("null")) + "\n";
} else if (Array.isArray(V)) {
s += "\n";
V.forEach((v) => s += t + "- " + (zrfPrettyPrint(v, indent + 2)));
} else {
if (V._classname != null) {
s += (clc.blue(V._classname)) + "\n";
} else {
s += "\n";
}
for (var k of Object.keys(V)) {
if (V[k] != null) {
s += t + " " + (clc.green(k)) + " " + (zrfPrettyPrint(V[k], indent + 1));
}
}
}
return s;
}
示例7: performanceDisplayInfo
function performanceDisplayInfo(time: Date, info: string): string {
return colors.yellow('[perf][' + time + '] ' + info);
}
示例8: exitWithError
static exitWithError(errorMessage: string) {
console.log(
color.yellow(
"\n+----------------------------------------------+" +
"\n| ") + color.xterm(200).bold('An error occurred - Can\'t continue') + color.yellow(" |" +
"\n+----------------------------------------------+") +
"\n" +
"\nError:\n" +
color.red.bold(errorMessage) +
"\n");
process.exit(1);
}
示例9: deploy
deploy() {
var start = (new Date()).getTime(),
deployPromise: Q.IPromise<boolean>,
config = this.serviceContainer.config,
packageData: any = JSON.parse('' + fs.readFileSync(__dirname + '/../../package.json'));
this.serviceContainer.log.logAndKeepColors(
color.yellow(
"\n\n+----------------------------------------------------+" +
"\n| ") + color.xterm(200).bold('Mouflon - your deployment manager') + ' ' + (' v' + packageData.version).substr(-10, 10) + color.yellow(" |" +
"\n+----------------------------------------------------+") +
"\n\n");
this.serviceContainer.log.startSection(sprintf('Deploying "%s" to "%s"...', config.projectName, config.stageName));
this.serviceContainer.log.debug('Timestamp is ' + color.whiteBright.bold(this.timestamp));
if (this.serviceContainer.config.verbose) {
this.serviceContainer.log.debug('Verbose mode is enabled');
}
this.serviceContainer.log.debug('Working paths: ' + this.serviceContainer.config.paths.getReadable());
deployPromise = this.deployManager.deploy();
deployPromise.then(
() => {
var end = (new Date()).getTime();
this.serviceContainer.log.closeSection(sprintf(
'It took %ss to deploy "%s" to "%s". :)' + "\n\n",
(0.001 * (end - start)).toFixed(3),
config.projectName,
config.stageName
));
},
(error) => {
Utils.exitWithError(error);
}
);
}
示例10: warn
warn(msg: string) {
this.messages_.push(this.color_ ? clc.yellow(msg) : msg);
}