2016-04-04 20:36:54 +00:00
|
|
|
"use strict";
|
2016-02-23 13:34:40 +00:00
|
|
|
/// <reference path="./typings/main.d.ts" />
|
|
|
|
var plugins = require("./beautylog.plugins");
|
|
|
|
var defaultOptions = {
|
|
|
|
font: "Star Wars",
|
|
|
|
color: "green",
|
|
|
|
cb: function () { }
|
|
|
|
};
|
|
|
|
exports.figlet = function (textArg, optionsArg) {
|
|
|
|
var done = plugins.q.defer();
|
|
|
|
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
|
|
|
|
var options = plugins.lodash.assign(mergeOptions, optionsArg);
|
|
|
|
plugins.figlet(textArg, {
|
|
|
|
font: options.font,
|
|
|
|
horizontalLayout: 'default',
|
|
|
|
verticalLayout: 'default'
|
|
|
|
}, function (err, data) {
|
|
|
|
if (err) {
|
|
|
|
console.log('Something went wrong...');
|
|
|
|
console.dir(err);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
console.log(data[options.color]);
|
|
|
|
options.cb();
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
exports.figletSync = function (textArg, optionsArg) {
|
|
|
|
var mergeOptions = plugins.lodash.cloneDeep(defaultOptions);
|
|
|
|
var options = plugins.lodash.assign(mergeOptions, optionsArg);
|
|
|
|
console.log(plugins.figlet.textSync(textArg, {
|
|
|
|
font: options.font,
|
|
|
|
horizontalLayout: 'default',
|
|
|
|
verticalLayout: 'default'
|
|
|
|
})[options.color]);
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2016-05-01 23:41:21 +00:00
|
|
|
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5ub2RlLmZpZ2xldC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQU8sT0FBTyxXQUFXLHFCQUFxQixDQUFDLENBQUM7QUFDaEQsSUFBSSxjQ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