@entando/log
Version:
chalk wrapper for CLI commands
57 lines (52 loc) • 1.61 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _chalk = _interopRequireDefault(require("chalk"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
var padCenter = function padCenter(text) {
var padLenght = 80 - text.length;
var halfPad = ' '.repeat(padLenght / 2);
return halfPad + text + halfPad;
};
var Log = {
title: function title(text) {
console.log('='.repeat(80));
console.log(padCenter(text.toUpperCase()));
console.log('='.repeat(80));
return Log;
},
section: function section(text) {
console.log("\n".concat(_chalk["default"].cyan(text.toUpperCase()), "\n"));
return Log;
},
info: function info(text) {
console.log(" ".concat(text));
return Log;
},
check: function check(text) {
console.log(_chalk["default"].green(" \u2714 ") + text);
return Log;
},
cross: function cross(text) {
console.log(_chalk["default"].red(" \u2716 ") + text);
return Log;
},
success: function success(text) {
console.log(" ".concat(_chalk["default"].green(text)));
return Log;
},
error: function error(text) {
var err = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
console.log(" ".concat(_chalk["default"].red(text)), err);
return Log;
},
empty: function empty() {
var times = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1;
console.log('\n'.repeat(times || 1));
return Log;
}
};
var _default = Log;
exports["default"] = _default;