UNPKG

symfony-style-console

Version:

Use the style and utilities of the Symfony Console in Node.js

57 lines (56 loc) 1.74 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var env_1 = require("../env"); var Output_1 = require("./Output"); /** * An [[OutputInterface]] that buffers its written messages. * * @author Jean-François Simon <contact@jfsimon.fr> * * Original PHP class * * @author Florian Reuschel <florian@loilo.de> * * Port to TypeScript */ var BufferedOutput = /** @class */ (function (_super) { __extends(BufferedOutput, _super); function BufferedOutput() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.buffer = ''; return _this; } /** * Empties buffer and returns its content. * * @return string */ BufferedOutput.prototype.fetch = function () { var content = this.buffer; this.buffer = ''; return content; }; /** * {@inheritdoc} */ BufferedOutput.prototype.doWrite = function (message, newline) { this.buffer += message; if (newline) this.buffer += env_1.EOL; }; return BufferedOutput; }(Output_1.default)); exports.default = BufferedOutput;