beautylog.ora now supports intermediate log messages.

This commit is contained in:
Philipp Kunz 2016-05-14 16:26:38 +02:00
parent f5b51e2747
commit a790c3fc8e
12 changed files with 75 additions and 49 deletions

View File

@ -1,4 +1,4 @@
import { Table } from "./beautylog.classes.table"; import { Table } from "./beautylog.classes.table";
import { Ora } from "./beautylog.classes.ora"; import { Ora } from "./beautylog.classes.ora";
export declare let table: (tableTypeArg: string, tableHeadArrayArg?: string[]) => Table; export declare let table: (tableTypeArg: string, tableHeadArrayArg?: string[]) => Table;
export declare let ora: (textArg: string, colorArg: string) => Ora; export declare let ora: (textArg: string, colorArg: string, startArg?: boolean) => Ora;

View File

@ -5,8 +5,8 @@ var beautylog_classes_ora_1 = require("./beautylog.classes.ora");
exports.table = function (tableTypeArg, tableHeadArrayArg) { exports.table = function (tableTypeArg, tableHeadArrayArg) {
return new beautylog_classes_table_1.Table(tableTypeArg, tableHeadArrayArg); return new beautylog_classes_table_1.Table(tableTypeArg, tableHeadArrayArg);
}; };
exports.ora = function (textArg, colorArg) { exports.ora = function (textArg, colorArg, startArg) {
return new beautylog_classes_ora_1.Ora(textArg, colorArg); return new beautylog_classes_ora_1.Ora(textArg, colorArg, startArg);
}; };
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFFNUMsd0NBQW9CLDJCQUEyQixDQUFDLENBQUE7QUFDaEQsc0NBQWtCLHlCQUF5QixDQUFDLENBQUE7QUFFakMsYUFBSyxHQUFHLFVBQVMsWUFBbUIsRUFBQyxpQkFBMkI7SUFDdkUsTUFBTSxDQUFDLElBQUksK0JBQUssQ0FBQyxZQUFZLEVBQUMsaUJBQWlCLENBQUMsQ0FBQztBQUNyRCxDQUFDLENBQUE7QUFFVSxXQUFHLEdBQUcsVUFBUyxPQUFjLEVBQUMsUUFBZT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Q0FBQztBQUNyRCxDQUFDLENBQUE7QUFFVSxXQUFHLEdBQUcsVUFBUyxPQUFjLEVBQUMsUUFBZSxFQUFDLFFBQWlCO0lBQ3RFLE1BQU0sQ0FBQyxJQUFJLDJCQUFHLENBQUMsT0FBTyxFQUFDLFFBQVEsRUFBQyxRQUFRLENBQUMsQ0FBQztBQUM5QyxDQUFDLENBQUEiLCJmaWxlIjoiYmVhdXR5bG9nLmNsYXNzZXMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XHJcblxyXG5pbXBvcnQge1RhYmxlfSBmcm9tIFwiLi9iZWF1dHlsb2cuY2xhc3Nlcy50YWJsZVwiO1xyXG5pbXBvcnQge09yYX0gZnJvbSBcIi4vYmVhdXR5bG9nLmNsYXNzZXMub3JhXCI7XHJcblxyXG5leHBvcnQgbGV0IHRhYmxlID0gZnVuY3Rpb24odGFibGVUeXBlQXJnOnN0cmluZyx0YWJsZUhlYWRBcnJheUFyZz86c3RyaW5nW10pe1xyXG4gICAgcmV0dXJuIG5ldyBUYWJsZSh0YWJsZVR5cGVBcmcsdGFibGVIZWFkQXJyYXlBcmcpO1xyXG59XHJcblxyXG5leHBvcnQgbGV0IG9yYSA9IGZ1bmN0aW9uKHRleHRBcmc6c3RyaW5nLGNvbG9yQXJnOnN0cmluZyxzdGFydEFyZz86Ym9vbGVhbil7XHJcbiAgICByZXR1cm4gbmV3IE9yYSh0ZXh0QXJnLGNvbG9yQXJnLHN0YXJ0QXJnKTtcclxufSJdfQ==

View File

@ -1,9 +1,12 @@
export declare class Ora { export declare class Ora {
private _oraObject; private _oraObject;
state: string; state: string;
constructor(textArg: string, colorArg: string); constructor(textArg: string, colorArg: string, startArg?: boolean);
text(textArg: any): void; text(textArg: any): void;
start(): void;
end(): void; end(): void;
endOk(textArg: any): void; endOk(textArg: any): void;
endError(textArg: any): void; endError(textArg: any): void;
stop(): void;
log(logText: string, logType: string): void;
} }

View File

@ -3,18 +3,23 @@
var plugins = require("./beautylog.plugins"); var plugins = require("./beautylog.plugins");
var log = require("./beautylog.log"); var log = require("./beautylog.log");
var Ora = (function () { var Ora = (function () {
function Ora(textArg, colorArg) { function Ora(textArg, colorArg, startArg) {
if (startArg === void 0) { startArg = false; }
this._oraObject = plugins.ora({ this._oraObject = plugins.ora({
spinner: "dots", spinner: "dots",
text: textArg, text: textArg,
color: colorArg color: colorArg
}); });
this._oraObject.start(); startArg ? this._oraObject.start() : void (0);
} }
Ora.prototype.text = function (textArg) { Ora.prototype.text = function (textArg) {
this._oraObject.text = textArg; this._oraObject.text = textArg;
}; };
; ;
Ora.prototype.start = function () {
this._oraObject.start();
};
;
Ora.prototype.end = function () { Ora.prototype.end = function () {
this._oraObject.stop(); this._oraObject.stop();
this._oraObject.clear(); this._oraObject.clear();
@ -29,8 +34,17 @@ var Ora = (function () {
log.error(textArg); log.error(textArg);
}; };
; ;
Ora.prototype.stop = function () {
this.end();
};
// log methods that play nice with ora
Ora.prototype.log = function (logText, logType) {
this.stop();
log.log(logText, logType);
this.start();
};
return Ora; return Ora;
}()); }());
exports.Ora = Ora; exports.Ora = Ora;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLm9yYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFDL0MsSUFBWSxHQUFHLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV2QztJQUdJLGFBQVksT0FBYyxFQUFDLFFBQWU7UUFDdEMsSUFBSSxDQUFDLFVBQVUsR0FBRyxPQUFPLENBQUMsR0FBRyxDQUFDO1lBQzFCLE9BQU8sRUFBQyxNQUFNO1lBQ2QsSUFBSSxFQUFDLE9BQU87WUFDWixLQUFLL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XG4gICAgc3RhdGU6c3RyaW5nO1xyXG4gICAgY29uc3RydWN0b3IodGV4dEFyZzpzdHJpbmcsY29sb3JBcmc6c3RyaW5nKXtcclxuICAgICAgICB0aGlzLl9vcmFPYmplY3QgPSBwbHVnaW5zLm9yYSh7XHJcbiAgICAgICAgICAgIHNwaW5uZXI6XCJkb3RzXCIsXHJcbiAgICAgICAgICAgIHRleHQ6dGV4dEFyZyxcclxuICAgICAgICAgICAgY29sb3I6Y29sb3JBcmdcclxuICAgICAgICB9KTtcclxuICAgICAgICB0aGlzLl9vcmFPYmplY3Quc3RhcnQoKTtcclxuICAgIH1cclxuICAgIHRleHQodGV4dEFyZyl7XHJcbiAgICAgICAgdGhpcy5fb3JhT2JqZWN0LnRleHQgPSB0ZXh0QXJnO1xyXG4gICAgfTtcclxuICAgIGVuZCgpe1xyXG4gICAgICAgIHRoaXMuX29yYU9iamVjdC5zdG9wKCk7XHJcbiAgICAgICAgdGhpcy5fb3JhT2JqZWN0LmNsZWFyKCk7XHJcbiAgICB9XHJcbiAgICBlbmRPayh0ZXh0QXJnKXtcclxuICAgICAgICB0aGlzLmVuZCgpO1xyXG4gICAgICAgIGxvZy5vayh0ZXh0QXJnKTtcclxuICAgIH07XHJcbiAgICBlbmRFcnJvcih0ZXh0QXJnKXtcclxuICAgICAgICB0aGlzLmVuZCgpO1xyXG4gICAgICAgIGxvZy5lcnJvcih0ZXh0QXJnKTtcclxuICAgIH07XHJcbn0iXX0= //# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5jbGFzc2VzLm9yYS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsNENBQTRDO0FBQzVDLElBQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFDL0MsSUFBWSxHQUFHLFdBQU0saUJBQWlCLENBQUMsQ0FBQTtBQUV2QztJQUdJLGFBQVksT0FBYyxFQUFDL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AgIHRleHQodGV4dEFyZyl7XHJcbiAgICAgICAgdGhpcy5fb3JhT2JqZWN0LnRleHQgPSB0ZXh0QXJnO1xyXG4gICAgfTtcclxuICAgIFxyXG4gICAgc3RhcnQoKXtcclxuICAgICAgICB0aGlzLl9vcmFPYmplY3Quc3RhcnQoKTtcclxuICAgIH07XHJcbiAgICBlbmQoKXtcclxuICAgICAgICB0aGlzLl9vcmFPYmplY3Quc3RvcCgpO1xyXG4gICAgICAgIHRoaXMuX29yYU9iamVjdC5jbGVhcigpO1xyXG4gICAgfVxyXG4gICAgZW5kT2sodGV4dEFyZyl7XHJcbiAgICAgICAgdGhpcy5lbmQoKTtcclxuICAgICAgICBsb2cub2sodGV4dEFyZyk7XHJcbiAgICB9O1xyXG4gICAgZW5kRXJyb3IodGV4dEFyZyl7XHJcbiAgICAgICAgdGhpcy5lbmQoKTtcclxuICAgICAgICBsb2cuZXJyb3IodGV4dEFyZyk7XHJcbiAgICB9O1xyXG4gICAgc3RvcCgpeyAvLyBhbGlhcyBmb3IgZW5kXHJcbiAgICAgICAgdGhpcy5lbmQoKTtcclxuICAgIH1cclxuICAgIFxyXG4gICAgLy8gbG9nIG1ldGhvZHMgdGhhdCBwbGF5IG5pY2Ugd2l0aCBvcmFcclxuICAgIGxvZyhsb2dUZXh0OnN0cmluZyxsb2dUeXBlOnN0cmluZyl7XHJcbiAgICAgICAgdGhpcy5zdG9wKCk7XHJcbiAgICAgICAgbG9nLmxvZyhsb2dUZXh0LGxvZ1R5cGUpO1xyXG4gICAgICAgIHRoaXMuc3RhcnQoKTtcclxuICAgIH1cclxufSJdfQ==

View File

@ -1,2 +1,8 @@
declare var plugins: any; export declare let lodash: any;
export = plugins; export declare let smartenv: any;
export declare let q: any;
export declare let cliTable: any;
export declare let colors: any;
export declare let clc: any;
export declare let figlet: any;
export declare let ora: any;

View File

@ -1,19 +1,12 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
"use strict"; "use strict";
var plugins = { exports.lodash = require("lodash");
lodash: require("lodash"), exports.smartenv = require("smartenv");
smartenv: require("smartenv"), exports.q = require("q");
q: require("q") exports.cliTable = require("cli-table2");
}; exports.colors = require("colors");
if (plugins.smartenv.getEnv().isNode) { exports.clc = require("cli-color");
plugins = plugins.lodash.assign(plugins, { exports.figlet = require("figlet");
cliTable: require("cli-table2"), exports.ora = require("ora");
colors: require("colors"),
clc: require("cli-color"),
figlet: require("figlet"),
ora: require("ora")
});
}
module.exports = plugins;
//# sourceMappingURL=data:application/json;charset=utf8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImJlYXV0eWxvZy5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBLDRDQUE0Qzs7QUFFNUMsSUFBSSxPQUFPLEdBQU87SUFDZCxNQUFNLEVBQUUsT0FBTyxDQUFDLFFBQVEsQ0FBQztJQUN6QixRQUFRLEVBQUUsT0FBTyxDQUFDLFVBQVUsQ0FBQztJQUM3QixDQUFDLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQztDQUNsQixDQUFDO0FBQ0YsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLFFBQVEsQ0FBQyxNQUFNLEVBQUUsQ0FBQyxNQUFNLENBQUMsQ0FBQSxDQUFDO0lBQ2xDLE9BQU8sR0FBRyxPQUFPLENBQUMsTUFBTSxDQUFDLE1BQU0sQ0FBQyxPQUFPLEVBQUM7UUFDcEMsUUFBUSxFQUFHLE9BQU8sQ0FBQyxZQUFZLENBQUM7UUFDaEMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxRQUFRLENBQUM7UUFDekIsR0FBRyxFQUFFLE9BQU8sQ0FBQyxXQUFXLENBQUM7UUFDekIsTUFBTSxFQUFFLE9BQU8sQ0FBQyxRQUFRLENBQUM7UUFDekIsR0FBRyxFQUFFLE9BQU8sQ0FBQyxLQUFLLENBQUM7S0FDdEIsQ0FBQyxDQUFDO0FBQ1AsQ0FBQ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Q2hCLGdCQUFRLEdBQUcsT0FBTyxDQUFDLFlBQVksQ0FBQyxDQUFDO0FBQ2pDLGNBQU0sR0FBRyxPQUFPLENBQUMsUUFBUSxDQUFDLENBQUM7QUFDM0IsV0FBRyxHQUFHLE9BQU8sQ0FBQyxXQUFXLENBQUMsQ0FBQztBQUMzQixjQUFNLEdBQUcsT0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDO0FBQzNCLFdBQUcsR0FBRyxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUMiLCJmaWxlIjoiYmVhdXR5bG9nLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XHJcblxyXG5leHBvcnQgbGV0IGxvZGFzaCA9IHJlcXVpcmUoXCJsb2Rhc2hcIik7XHJcbmV4cG9ydCBsZXQgc21hcnRlbnYgPSByZXF1aXJlKFwic21hcnRlbnZcIik7XHJcbmV4cG9ydCBsZXQgcSA9IHJlcXVpcmUoXCJxXCIpXHJcbmV4cG9ydCBsZXQgY2xpVGFibGUgPSByZXF1aXJlKFwiY2xpLXRhYmxlMlwiKTtcclxuZXhwb3J0IGxldCBjb2xvcnMgPSByZXF1aXJlKFwiY29sb3JzXCIpO1xyXG5leHBvcnQgbGV0IGNsYyA9IHJlcXVpcmUoXCJjbGktY29sb3JcIik7XHJcbmV4cG9ydCBsZXQgZmlnbGV0ID0gcmVxdWlyZShcImZpZ2xldFwiKTtcclxuZXhwb3J0IGxldCBvcmEgPSByZXF1aXJlKFwib3JhXCIpO1xyXG4iXX0=

2
dist/index.d.ts vendored
View File

@ -7,7 +7,7 @@ export declare let figletSync: (textArg: string, optionsArg?: any) => boolean;
export declare let info: (logText: any) => void; export declare let info: (logText: any) => void;
export declare let log: (logText?: string, logType?: string) => void; export declare let log: (logText?: string, logType?: string) => void;
export declare let ok: (logText: any) => void; export declare let ok: (logText: any) => void;
export declare let ora: (textArg: string, colorArg: string) => Ora; export declare let ora: (textArg: string, colorArg: string, startArg?: boolean) => Ora;
export declare let success: (logText: any) => void; export declare let success: (logText: any) => void;
export declare let table: (tableTypeArg: string, tableHeadArrayArg?: string[]) => Table; export declare let table: (tableTypeArg: string, tableHeadArrayArg?: string[]) => Table;
export declare let warn: (logText: any) => void; export declare let warn: (logText: any) => void;

File diff suppressed because one or more lines are too long

View File

@ -49,9 +49,10 @@ describe("beautylog",function(){
describe(".ora(text,color)",function(){ describe(".ora(text,color)",function(){
it("should display, update, and end a message",function(done){ it("should display, update, and end a message",function(done){
this.timeout(10000); this.timeout(10000);
let testOra = beautylog.ora("This is a test text","green"); let testOra = beautylog.ora("This is a test text","green",true);
setTimeout(function(){ setTimeout(function(){
testOra.text("updated text!"); testOra.text("updated text!");
testOra.log("an intermediate log message","info");
setTimeout(function(){ setTimeout(function(){
testOra.endOk("Allright, ora works!"); testOra.endOk("Allright, ora works!");
done(); done();

View File

@ -5,17 +5,22 @@ import * as log from "./beautylog.log";
export class Ora { export class Ora {
private _oraObject; private _oraObject;
state:string; state:string;
constructor(textArg:string,colorArg:string){ constructor(textArg:string,colorArg:string,startArg:boolean = false){
this._oraObject = plugins.ora({ this._oraObject = plugins.ora({
spinner:"dots", spinner:"dots",
text:textArg, text:textArg,
color:colorArg color:colorArg
}); });
this._oraObject.start();
startArg ? this._oraObject.start() : void(0);
} }
text(textArg){ text(textArg){
this._oraObject.text = textArg; this._oraObject.text = textArg;
}; };
start(){
this._oraObject.start();
};
end(){ end(){
this._oraObject.stop(); this._oraObject.stop();
this._oraObject.clear(); this._oraObject.clear();
@ -28,4 +33,14 @@ export class Ora {
this.end(); this.end();
log.error(textArg); log.error(textArg);
}; };
stop(){ // alias for end
this.end();
}
// log methods that play nice with ora
log(logText:string,logType:string){
this.stop();
log.log(logText,logType);
this.start();
}
} }

View File

@ -7,6 +7,6 @@ export let table = function(tableTypeArg:string,tableHeadArrayArg?:string[]){
return new Table(tableTypeArg,tableHeadArrayArg); return new Table(tableTypeArg,tableHeadArrayArg);
} }
export let ora = function(textArg:string,colorArg:string){ export let ora = function(textArg:string,colorArg:string,startArg?:boolean){
return new Ora(textArg,colorArg); return new Ora(textArg,colorArg,startArg);
} }

View File

@ -1,17 +1,10 @@
/// <reference path="./typings/main.d.ts" /> /// <reference path="./typings/main.d.ts" />
var plugins:any = { export let lodash = require("lodash");
lodash: require("lodash"), export let smartenv = require("smartenv");
smartenv: require("smartenv"), export let q = require("q")
q: require("q") export let cliTable = require("cli-table2");
}; export let colors = require("colors");
if (plugins.smartenv.getEnv().isNode){ export let clc = require("cli-color");
plugins = plugins.lodash.assign(plugins,{ export let figlet = require("figlet");
cliTable: require("cli-table2"), export let ora = require("ora");
colors: require("colors"),
clc: require("cli-color"),
figlet: require("figlet"),
ora: require("ora")
});
}
export = plugins;