本文整理汇总了TypeScript中cli-color.cyan函数的典型用法代码示例。如果您正苦于以下问题:TypeScript cyan函数的具体用法?TypeScript cyan怎么用?TypeScript cyan使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cyan函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: 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;
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:28,代码来源:indexes.ts
示例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;
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:36,代码来源:indexes.ts
示例3: assertHasOneOf
export function assertHasOneOf(obj: any, props: string[]): void {
const objString = clc.cyan(JSON.stringify(obj));
let count = 0;
props.forEach((prop) => {
if (obj[prop]) {
count++;
}
});
if (count !== 1) {
throw new FirebaseError(`Must contain exactly one of "${props.join(",")}": ${objString}`);
}
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:13,代码来源:validator.ts
示例4: assertHas
export function assertHas(obj: any, prop: string): void {
const objString = clc.cyan(JSON.stringify(obj));
if (!obj[prop]) {
throw new FirebaseError(`Must contain "${prop}": ${objString}`);
}
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:6,代码来源:validator.ts
示例5: assertEnum
export function assertEnum(obj: any, prop: string, valid: any[]): void {
const objString = clc.cyan(JSON.stringify(obj));
if (valid.indexOf(obj[prop]) < 0) {
throw new FirebaseError(`Field "${prop}" must be one of ${valid.join(", ")}: ${objString}`);
}
}
开发者ID:firebase,项目名称:firebase-tools,代码行数:6,代码来源:validator.ts
示例6: showField
public static showField(game: goita.Game, turn: number) {
const player = game.board.players[turn];
if (player.no % 2 === 0) {
console.write("your team:" + clc.green(game.scores[0]) + " opponent:" + clc.green(game.scores[1]) + "\n");
} else {
console.write("opponent:" + clc.green(game.scores[0]) + " your team:" + clc.green(game.scores[1]) + "\n");
}
console.write("round: " + game.roundCount + "\n");
console.write("------------------------\n");
const history = new Array<string>();
history.push("p1 ", "p2 ", "p3 ", "p4 ");
for (let i = 0; i < game.board.history.dealer; i++) {
history[i] += "| ";
}
for (let i = 0; i < game.board.history.moveStack.length; i++) {
const m = game.board.history.moveStack[i];
const p = goita.Util.shiftTurn(i % 4, game.board.history.dealer);
let hs = "";
if (m.pass) {
hs = clc.blackBright("なし");
} else if (m.faceDown) {
hs = goita.Koma.hidden.Text + m.attack.Text;
hs = clc.cyanBright(hs);
} else {
hs = m.block.Text + m.attack.Text;
hs = clc.cyanBright(hs);
}
history[p] += "| " + hs;
}
for (const h of history) {
console.write(h);
console.write("\n");
}
console.write("------------------------\n");
const pLabel = new Array<string>();
const bLine = new Array<goita.Koma[]>();
const aLine = new Array<goita.Koma[]>();
const empty = "_";
for (const p of game.board.players) {
const l = "p" + (p.no + 1) + ":";
pLabel.push(l);
const b = p.field.filter((k, i) => i % 2 === 0);
bLine.push(b);
const a = p.field.filter((k, i) => i % 2 !== 0);
aLine.push(a);
}
const pNo = goita.Util.shiftTurn(player.no, 2);
console.write(" ");
console.write(pLabel[pNo]);
for (const a of aLine[pNo].reverse()) {
console.write(clc.cyan(a === goita.Koma.empty ? empty : a.Text));
}
console.write("\n");
console.write(" ");
for (const b of bLine[pNo].reverse()) {
console.write(clc.cyan(b === goita.Koma.empty ? empty : b.Text));
}
console.write("\n");
const lOpNo = goita.Util.shiftTurn(player.no, -1);
const rOpNo = goita.Util.shiftTurn(player.no, 1);
console.write(pLabel[lOpNo]);
console.write(" ");
console.write(pLabel[rOpNo]);
console.write("\n");
const laLine = aLine[lOpNo].map((k) => k === goita.Koma.empty ? empty : k.Text);
const lbLine = bLine[lOpNo].map((k) => k === goita.Koma.empty ? empty : k.Text);
const raLine = aLine[rOpNo].map((k) => k === goita.Koma.empty ? empty : k.Text);
const rbLine = bLine[rOpNo].map((k) => k === goita.Koma.empty ? empty : k.Text);
for (let i = 0; i < 4; i++) {
let s = "";
s += laLine[i];
s += lbLine[i];
s += " ";
s += rbLine[3 - i];
s += raLine[3 - i];
console.write(clc.cyan(s));
console.write("\n");
}
console.write(" ");
console.write(pLabel[player.no]);
for (const b of bLine[player.no]) {
console.write(clc.cyan(b === goita.Koma.empty ? empty : b.Text));
}
console.write("\n");
console.write(" ");
for (const a of aLine[player.no]) {
console.write(clc.cyan(a === goita.Koma.empty ? empty : a.Text));
}
console.write("\n");
console.write("------------------------\n");
}
开发者ID:Goita,项目名称:goita-cli,代码行数:99,代码来源:cui.ts
注:本文中的cli-color.cyan函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论