UNPKG

salesforcedx-templates

Version:

Salesforce CLI scaffolding commands for different types of Force.com metadata

59 lines 1.62 kB
/* * Copyright (c) 2019, salesforce.com, inc. * All rights reserved. * Licensed under the BSD 3-Clause license. * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause * Derived from https://github.com/yeoman/environment/blob/master/lib/util/log.js */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); const util = require("util"); const padding = ' '; const statuses = [ 'skip', 'force', 'create', 'invoke', 'conflict', 'identical', 'info' ]; class Log { constructor() { this.output = ''; this.cleanOutput = []; for (const status of statuses) { this[status] = (arg) => { if (status !== 'identical' && status !== 'conflict') { this.cleanOutput.push(arg); } this.write(this.pad(status)).write(padding); this.write(`${arg}\n`); return this; }; } } getOutput() { return this.output; } getCleanOutput() { return this.cleanOutput; } write(...args) { this.output = this.output + util.format.apply(util, args); return this; } pad(status) { let max = 'identical'.length; let delta = max - status.length; return delta ? new Array(delta + 1).join(' ') + status : status; } setOutput(text) { this.output = text; } setCleanOutput(cleanText) { this.cleanOutput = cleanText; } } exports.Log = Log; //# sourceMappingURL=logger.js.map