本文整理汇总了TypeScript中cli-color.green函数的典型用法代码示例。如果您正苦于以下问题:TypeScript green函数的具体用法?TypeScript green怎么用?TypeScript green使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了green函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: 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.'));
}
示例2: 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);
示例3: 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;
}
示例4: 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;
}
示例5: serverPrintInfo
function serverPrintInfo() {
return console.log(C.white('Welcome to') + " " +
C.green(config.SITE_NAME) + " " + C.white('server') + " " +
"" + C.green("V" + config.VERSION_MAJOR + "." + config.VERSION_MINOR + "." + config.VERSION_COUNTER)
);
};
示例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");
}
示例7: success
success(msg: string) {
this.messages_.push(this.color_ ? clc.green(msg) : msg);
}