"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.prettify = void 0;
const cli_tools_1 = require("@codiac.io/cli-tools");
const YAML = require("yaml");
/** Renders the given entity as YAML with color-coded keys and values. */
function prettify(entity, hideEntities = [], options) {
    let output = YAML.stringify(entity, { indent: 2 });
    let styler = new cli_tools_1.TtyOutputStyler();
    let lines = output.split("\n");
    for (let idx in lines) {
        let line = lines[idx];
        let pos = line.indexOf(":");
        let value = line.substr(pos + 1);
        const hide = hideEntities.find(f => (f !== undefined && f.trim() == value.trim()));
        if (hide)
            value = "*********";
        lines[idx] = line.substr(0, pos + 1).concat(styler.hilite(value));
    }
    output = lines.join("\n");
    return output;
}
exports.prettify = prettify;
//# sourceMappingURL=prettify.js.map