@sap/cli-core
Version:
Command-Line Interface (CLI) Core Module
22 lines (21 loc) • 890 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.create = void 0;
const constants_1 = require("../../../constants");
const logger_1 = require("../../../logger");
const options_1 = require("../../../utils/options");
const utils_1 = require("./utils");
/* jscpd:ignore-start */
const create = (option) => async () => async () => {
const { debug, trace } = (0, logger_1.get)("commands.handler.options.file");
/* jscpd:ignore-end */
debug(`reading option ${option.longName} from file`);
const filePath = (0, options_1.getOptionValueFromConfig)(constants_1.OPTION_OPTIONS_FILE);
try {
(0, utils_1.setOption)(option, await (0, utils_1.getValueFromOptionsFile)(filePath, option));
}
catch (err) {
trace(`failed to read option ${option.longName} from options file ${filePath}`, err);
}
};
exports.create = create;