morbo-cli
Version:
… All tech debt is vermin in the eyes of Morbo!
50 lines (49 loc) • 1.91 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var ora_1 = __importDefault(require("ora"));
var noop = function () { };
var MorboSpinner = /** @class */ (function () {
function MorboSpinner() {
var _this = this;
this.spinner = ora_1.default({
text: 'Morbo scanning your puny human codebase!',
color: 'green',
});
this.morboSayings = [
'Humans have easily injured knees',
'Morbo wishes these stalwart nomads peace among the codebase.',
'May death come quickly to your tech debt',
'This reporter applauds the demise of the pathetic code!',
'Hello, little todo. I will destroy you!',
];
this.start = function () {
_this.morboSayingInterval = setInterval(_this.updateMorboSpinner, 3000);
_this.spinner.start();
};
this.succeed = function (fileName) {
_this.spinner.succeed("Report created: " + fileName);
};
this.updateText = function (text) {
if (_this.morboSayingInterval) {
clearInterval(_this.morboSayingInterval);
}
_this.spinner.text = text;
return null;
};
this.updateMorboSpinner = function () {
if (!_this.spinner.isSpinning) {
clearInterval(_this.morboSayingInterval);
return false;
}
var randomSayingIndex = Math.floor(Math.random() * _this.morboSayings.length);
_this.spinner.text = _this.morboSayings[randomSayingIndex];
return null;
};
this.morboSayingInterval = 0;
}
return MorboSpinner;
}());
exports.default = MorboSpinner;