2016-05-02 00:23:40 +00:00
|
|
|
"use strict";
|
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:04:40 +00:00
|
|
|
console.log(colorFiglet(data, optionsArg.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
|
|
|
});
|
|
|
|
console.log(colorFiglet(figletString, optionsArg.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;
|
|
|
|
};
|
|
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYmVhdXR5bG9nLmZpZ2xldC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2JlYXV0eWxvZy5maWdsZXQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLDBCQUF1QjtBQUN2QiwrQ0FBK0M7QUFRL0MsSUFBSSxjQUFjLEdBQW1CO0lBQ2pDLElBQUksRUFBRSxXQUFXO0lBQ2pCLEtBQUssRUFBRSxPQUFPO0lBQ2QsRUFBRSxFQUFFLGNBQVksQ0FBQztDQUNwQixDQUFBO0FBRVUsUUFBQSxNQUFNLEdBQUcsVUFBUyxPQUFlLEVBQUUsVUFBVztJQUNyRCxJQUFJLElBQUksR0FBRyxPQUFPLENBQUMsQ0FBQyxDQUFDLEtBQUssRUFBRSxDQUFBO0lBQzVCLElBQUksWUFBWSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsU0FBUyxDQUFDLGNBQWMsQ0FBQyxDQUFBO0lBQzNELElBQUksT0FBTyxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsTUFBTSxDQUFDLFlBQVksRUFBQyxVQUFVLENBQUMsQ0FBQTtJQUM1RCxPQUFPLENBQUMsTUFBTSxDQUNWLE9BQU8sRUFDUDtRQUNJLElBQUksRUFBRSxPQUFPLENBQUMsSUFBSTtRQUNsQixnQkFBZ0IsRUFBRSxTQUFTO1FBQzNCLGNBQWMs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