2016-05-02 00:23:40 +00:00
|
|
|
"use strict";
|
2017-03-11 11:30:18 +00:00
|
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
2016-05-23 07:10:30 +00:00
|
|
|
require("typings-global");
|
2016-07-23 17:47:23 +00:00
|
|
|
const plugins = require("./beautylog.plugins");
|
2016-10-16 00:26:43 +00:00
|
|
|
let defaultOptions = {
|
|
|
|
font: 'Star Wars',
|
|
|
|
color: 'green',
|
2016-05-02 00:23:40 +00:00
|
|
|
cb: function () { }
|
|
|
|
};
|
|
|
|
exports.figlet = function (textArg, optionsArg) {
|
2016-10-16 00:26:43 +00:00
|
|
|
let done = plugins.q.defer();
|
|
|
|
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
|
|
|
|
let options = plugins.lodash.assign(mergeOptions, optionsArg);
|
2016-05-02 00:23:40 +00:00
|
|
|
plugins.figlet(textArg, {
|
|
|
|
font: options.font,
|
|
|
|
horizontalLayout: 'default',
|
|
|
|
verticalLayout: 'default'
|
|
|
|
}, function (err, data) {
|
|
|
|
if (err) {
|
|
|
|
console.log('Something went wrong...');
|
|
|
|
console.dir(err);
|
|
|
|
return;
|
|
|
|
}
|
2017-01-21 18:33:14 +00:00
|
|
|
console.log(colorFiglet(data, options.color));
|
2016-05-02 00:23:40 +00:00
|
|
|
options.cb();
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
exports.figletSync = function (textArg, optionsArg) {
|
2016-10-16 00:26:43 +00:00
|
|
|
let mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
|
|
|
|
let options = plugins.lodash.assign(mergeOptions, optionsArg);
|
2017-01-21 18:04:40 +00:00
|
|
|
let figletString = plugins.figlet.textSync(textArg, {
|
2016-05-02 00:23:40 +00:00
|
|
|
font: options.font,
|
|
|
|
horizontalLayout: 'default',
|
|
|
|
verticalLayout: 'default'
|
2017-01-21 18:04:40 +00:00
|
|
|
});
|
2017-01-21 18:33:14 +00:00
|
|
|
console.log(colorFiglet(figletString, options.color));
|
2016-05-02 00:23:40 +00:00
|
|
|
return true;
|
|
|
|
};
|
2017-01-21 18:04:40 +00:00
|
|
|
let colorFiglet = (figletStringArg, colorArg) => {
|
|
|
|
let figletArray = figletStringArg.split('\n');
|
|
|
|
let figletStringCombined = '';
|
|
|
|
for (let figletRow of figletArray) {
|
|
|
|
figletRow = plugins.beautycolor.coloredString(figletRow, colorArg);
|
|
|
|
figletStringCombined = figletStringCombined + figletRow + '\n';
|
|
|
|
}
|
|
|
|
return figletStringCombined;
|
|
|
|
};
|
2017-03-11 11:30:18 +00:00
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmZpZ2xldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSwwQkFBdUI7QUFDdkIsK0NBQStDO0FBUS9DLElBQUksY0FBYyxHQUFtQjtJQUNqQyxJQUFJLEVBQUUsV0FBVztJQUNqQixLQUFLLEVBQUUsT0FBTztJQUNkLEVBQUUsRUFBRSxjQUFZLENBQUM7Q0FDcEIsQ0FBQTtBQUVVLFFBQUEsTUFBTSxHQUFHLFVBQVMsT0FBZSxFQUFFLFVBQVc7SUFDckQsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtJQUM1QixJQUFJLFlBQVksR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUMsQ0FBQTtJQUMzRCxJQUFJLE9BQU8sR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxZQUFZLEVBQUMsVUFBVSxDQUFDLENBQUE7SUFDNUQsT0FBTyxDQUFDLE1BQU0sQ0FDVixPQUFPLEVBQ1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