53 lines
4.2 KiB
JavaScript
53 lines
4.2 KiB
JavaScript
"use strict";
|
|
require("typings-global");
|
|
var plugins = require("./beautylog.plugins");
|
|
var tableHelpers = {
|
|
makeRow: function (cellCounterArg, colorArg) {
|
|
if (cellCounterArg === void 0) { cellCounterArg = 2; }
|
|
if (colorArg === void 0) { colorArg = "cyan"; }
|
|
var rowArray = [];
|
|
for (var i = 0; i < (cellCounterArg); i++) {
|
|
rowArray.push(String(i + 1).cyan);
|
|
}
|
|
return rowArray;
|
|
}
|
|
};
|
|
var Table = (function () {
|
|
function Table(tableTypeArg, tableHeadArrayArg) {
|
|
if (tableHeadArrayArg === void 0) { tableHeadArrayArg = tableHelpers.makeRow(); }
|
|
switch (tableTypeArg) {
|
|
case "checks":
|
|
this.tableHead = ['Check Item:'.cyan, 'Status:'.cyan];
|
|
break;
|
|
case "custom":
|
|
this.tableHead = tableHeadArrayArg;
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
this.rows = [];
|
|
this.type = tableTypeArg;
|
|
}
|
|
Table.prototype.push = function (row) {
|
|
this.rows.push(row);
|
|
};
|
|
Table.prototype.print = function () {
|
|
var table = new plugins.cliTable({
|
|
head: this.tableHead
|
|
});
|
|
for (var row in this.rows) {
|
|
if (this.rows[row][1] == "success") {
|
|
this.rows[row][1] = ' '.bgGreen + ' ' + this.rows[row][1];
|
|
}
|
|
else if (this.rows[row][1] == "error") {
|
|
this.rows[row][1] = ' '.bgRed + ' ' + this.rows[row][1];
|
|
}
|
|
table.push(this.rows[row]);
|
|
}
|
|
;
|
|
console.log(table.toString());
|
|
};
|
|
return Table;
|
|
}());
|
|
exports.Table = Table;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMudGFibGUuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9iZWF1dHlsb2cuY2xhc3Nlcy50YWJsZS50cyJdLCJuYW1lcyI6W10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