UNPKG

@crestron/ch5-shell-utilities-cli

Version:
73 lines (72 loc) 2.81 kB
"use strict"; // Copyright (C) 2021 to the present, Crestron Electronics, Inc. // All rights reserved. // No part of this software may be reproduced in any form, machine // or natural, without the express written consent of Crestron Electronics. // Use of this source code is subject to the terms of the Crestron Software License Agreement // under which you licensed this source code. var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) { if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { if (ar || !(i in from)) { if (!ar) ar = Array.prototype.slice.call(from, 0, i); ar[i] = from[i]; } } return to.concat(ar || Array.prototype.slice.call(from)); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.Ch5CliConfigFileReader = void 0; var fs = require("fs"); var Ch5CliConfigFileReader = /** @class */ (function () { function Ch5CliConfigFileReader(path, content) { this._configFileOptions = []; this.COMMON_INPUT_PARAMS = [ { "key": "verbose", "description": "", "type": "boolean", "default": true, "valueIfNotFound": false, "alias": ["--verbose"], "isSpecialArgument": true }, { "key": "help", "description": "", "type": "boolean", "default": true, "valueIfNotFound": false, "alias": ["-h", "--help"], "isSpecialArgument": true } ]; this._configFile = JSON.parse(fs.readFileSync(path, 'utf8')); if (content) { this._configFile = __assign(__assign({}, this._configFile), content); } this._configFileOptions = __spreadArray(__spreadArray([], this._configFile.options, true), this.COMMON_INPUT_PARAMS, true); } Object.defineProperty(Ch5CliConfigFileReader.prototype, "configFile", { get: function () { return this._configFile; }, enumerable: false, configurable: true }); Ch5CliConfigFileReader.prototype.configParamOptions = function () { return this._configFileOptions; }; return Ch5CliConfigFileReader; }()); exports.Ch5CliConfigFileReader = Ch5CliConfigFileReader;